当我执行df.info()时:
datasets=dataset.apply(pd.to_numeric,errors='coerce')
print(dataset.info())
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 2192 entries, 2012-01-01 to 2017-12-31
Data columns (total 15 columns):
Temp_min 2192 non-null int64
Temp_max 2192 non-null int64
Temp_mean 2192 non-null float64
humidity 2192 non-null int64
wind 2192 non-null int64
Rain 2191 non-null float64
Latitude (*N) 2192 non-null float64
Daytime_hour % 2192 non-null float64
Soil 0 non-null float64
Stage 0 non-null float64
Kc 2182 non-null float64
ETo 2192 non-null float64
ETcrop(mm/day) 2182 non-null float64
PERC(mm/day) 2192 non-null int64
Irrigation Requirement (mm/day) 2182 non-null float64
dtypes: float64(10), int64(5)
memory usage: 274.0 KB
None
但是在运行期间:
evaluate_model(train, test, n_input);
我遇到错误:
ValueError:无法将字符串转换为float:'Clay'
请建议我如何克服此问题。我应该将“粘土”存储为一些整数,例如“ 0”,将“ Sandy”存储为“ 1”以解决上述问题。如果是这样,什么字符串值未存储在数据集中?请使用任何合适的方法阐明我的问题。谢谢!