I want to convert the columns of this list to numeric using the pandas.to_numeric function, catching the errors and force the conversion by supplying errors='coerce' as an argument for pandas.to_numeric :
wrong_type_columns = ['DewPointHighF', 'DewPointAvgF', 'DewPointLowF', 'HumidityHighPercent',
'HumidityAvgPercent', 'HumidityLowPercent', 'SeaLevelPressureHighInches',
'SeaLevelPressureAvgInches' ,'SeaLevelPressureLowInches', VisibilityHighMiles',
'VisibilityAvgMiles', 'VisibilityLowMiles', 'WindHighMPH', 'WindAvgMPH',
'WindGustMPH', 'PrecipitationSumInches']
I'll try this code:
wrong_type_columns = wrong_type_columns.apply(pd.to_numeric, errors='coerce', axis=1).astype(int)
but i get this error:
AttributeError: 'list' object has no attribute 'apply'