Trying to make a scatter plot with a pandas dataframe, but "ValueError: x and y must be the same size" kept popping up. Looks like Slaughter Steers data column are strings instead of floats so try to convert it, but ValueError: could not convert string to float: '1,062.6' happens. Tried to replace ' with a space still same error.
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
#Read in Data set date as index
cattle_price = pd.read_csv('C:/Users/SkyLH/Documents/CattleForcast Model/Slaughter Cattle Monthly Data.csv', index_col = 'DATE')
cattle_slaughter = pd.read_csv('C:/Users/SkyLH/Documents/Cattle Forcast Model/SlaughterCountsFull - Sheet1.csv', index_col = 'Date')
cattle_price.index = pd.to_datetime(cattle_price.index)
cattle_price.index.names = ['Date',]
cattle_slaughter.replace("'"," ")
cattle_slaughter.astype(float)
cattle_df = cattle_price.join(cattle_slaughter, how = 'inner')
print(cattle_df)
plt.scatter(cattle_df, y = 'Price')
plt.show()
                Price Slaughter Steers
Date                                  
1955-01-01  34.899999            983.8
1955-02-01  35.999998            847.9
1955-03-01  34.600001          1,062.6
1955-04-01  35.800002          1,000.9
1955-05-01  33.100002          1,090.1
 
    