pandas 强制类型转换 df.astype

import pandas as pd
from matplotlib import pyplot as plt
from datetime import datetime
filename='sitka_weather_2014.csv'



df=pd.read_csv(filename)
print(df.dtypes)

pandas 强制类型转换 df.astype_第1张图片

df[' Min Humidity']=df[' Min Humidity'].astype('float64')
df=df.astype({'Max Humidity':'float64','Max Dew PointF':'float64'})

print('*'*44)
print(df.dtypes)

pandas 强制类型转换 df.astype_第2张图片

 

你可能感兴趣的:(pandas)