import pandas as pd
drinks = pd.read_csv('drinks.csv',nrows=5)
drinks.dtypes
country object
beer_servings int64
spirit_servings int64
wine_servings int64
total_litres_of_pure_alcohol float64
continent object
dtype: object
这将返回一个Series,其中包含每列的数据类型。结果的索引是原始DataFrame的列
print(type(drinks.dtypes))
<class 'pandas.core.series.Series'>
drinks
country< |
---|