0

How I can parse to float the string data of a specific column in a dataframe?

df = pd.DataFrame(data=dict_kv, columns = header) df.head() Provinces Confirmed cases Confirmed deaths Probable deaths 0 Azuay 10658 195 12 1 Bolívar 2111 66 12 2 Cañar 2110 83 7 3 Carchi 3053 104 1 For instance, for this dataframe I only want parse to float the data in the columns: Confirmed cases, Confirmed deaths, Probable deaths

3rd Nov 2020, 12:06 AM
Rosana Rodríguez Milanés
Rosana Rodríguez Milanés - avatar
1 Answer
+ 1
You can create a new dataframe with the columns you want... something like this new_df=df['Confirmed cases', 'Confirmed deaths', 'Probable deaths']
3rd Nov 2020, 1:24 AM
Steven M
Steven M - avatar