1.创建一个如下的叫做fruits的Dataframe:
import pandas as pd fruits = pd.Dataframe({'Apples':[30],'Bananas':[21]})
2.创建一个如下的叫做fruit_sales的Dataframe:
fruit_sales = pd.Dataframe({'Apples':[35,41],'Bananas':[21,34]}, index = ['2017 Sales','2018 Sales'])
3.用Series创建一个ingredients如下一样:
ingredients = pd.Series(['4 cups','1 cup','2 large','1 can'], index = ['Flour','Milk','Eggs','Spam'],name = 'Dinner')
4.读../input/wine-reviews/winemag-data_first150k.csv路径下的csv文件为叫做reviews
reviews = pd.read_csv("../input/wine-reviews/winemag-data_first150k.csv",index_col = 0)
5.创建了一个叫做animals的Dataframe将他保存为CSV格式命名为cows_and_goats.csv
animals.to_csv("cows_and_goats.csv")
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)