点击运行
import pandas as pd #不指定索引 data = {'Name':['Tom', 'Jack', 'Steve', 'Ricky'],'Age':[28,34,29,42]} df = pd.DataFrame(data) print(df) #指定索引 index_df = pd.DataFrame(data, index=['rank1','rank2','rank3','rank4']) print(index_df)
运行结果 :
正在执行...