When I am writing/saving the csv file column data are saving in NoneType
Individually I am changing them to numeric type using below command
df['A'] = pd.to_numeric(df['A'])
Its fine when there are few columns but in large data set converting individual column is a big task I am doing this because I have to plot the line graph using column data, bcz of NoneType not able to plot graph I want to save the data in their default data type like float data save into float type and integer data save into int type
CodePudding user response:
Check this. Hope it will solve your problem :
df = pd.to_numeric(df)
CodePudding user response:
If you have columns that are non-numeric, you can try this
for c in df.columns:
try:
df[c]=pd.to_numeric(df[c])
except:
pass