I have a simple question, I am creating new column in a list of dataFrame within function. I got this error
data['datenum'] = np.zeros((data))
TypeError: 'DataFrame' object cannot be interpreted as an integer
I have a simple question, I am creating new column in a list of dataFrame within function. I got this error
data['datenum'] = np.zeros((data))
TypeError: 'DataFrame' object cannot be interpreted as an integer
Your argument to np.zeros needs to be an integer. Right now you have data, which you say is a DataFrame. Perhaps you're looking for:
data['datenum'] = np.zeros(data.shape[0])
If you have multiple dataframes, you can do the following:
for data in dataframes:
data['datenum'] = np.zeros(data.shape[0])