I want to convert all the non float type columns of my dataframe to float ,is there any way i can do it .It would be great if i can do it in One Go . Below is the type
longitude - float64
latitude - float64
housing_median_age - float64
total_rooms - float64
total_bedrooms - object
population - float64
households - float64
median_income - float64
rooms_per_household - float64
category_<1H OCEAN - uint8
category_INLAND - uint8
category_ISLAND - uint8
category_NEAR BAY - uint8
category_NEAR OCEAN - uint8
Below is the snippet of my code
import pandas as pd
import numpy as np
from sklearn.model_selection import KFold
df = pd.DataFrame(housing)
df['ocean_proximity'] = pd.Categorical(df['ocean_proximity']) #type casting
dfDummies = pd.get_dummies(df['ocean_proximity'], prefix = 'category' )
df = pd.concat([df, dfDummies], axis=1)
print df.head()
housingdata = df
hf = housingdata.drop(['median_house_value','ocean_proximity'], axis=1)
hl = housingdata[['median_house_value']]
hf.fillna(hf.mean,inplace = True)
hl.fillna(hf.mean,inplace = True)