踩坑记录

···
import pandas as pd
tips=pd.read_csv(r'C:\Users\TAO\Desktop\python-for-data-analysis-master\examples\tips.csv')
tips_count=pd.crosstab(tips.day, tips.size)
tips_count=tips_count.iloc[:,2:5]
tips_count

无法正常显示,但是df['a']和df.a基本等价,所以尝试转换发现可以执行,兴奋,遂记之

import pandas as pd
tips=pd.read_csv(r'C:\Users\TAO\Desktop\python-for-data-analysis-master\examples\tips.csv')
tips_count=pd.crosstab(tips.day, tips['size'])
tips_count=tips_count.iloc[:,2:5]
tips_count
···


image.png

提示说强烈反对用ix来切割df,建议用iloc,尝试了确实更好用。

你可能感兴趣的:(踩坑记录)