How I can parse to float the string data of a specific column in a dataframe? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Resposta
+ 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