返回顶部

[央视新闻] 如何使用行索引将一个 DataFrame 分割成多个较小的 DataFrame[手机搜狐网]

0

0/300

评论 1

cc果冻儿

import pandas as pd apprix_df = pd.DataFrame({ 'Name': ["Anish","Rabindra","Manish","Samir","Binam"], 'Post': ["CEO","CTO","System Admin","Consultant","Engineer"], 'Qualification':["MBA","MS","MCA","PhD","BE"] }) print("Apprix Team DataFrame:") print(apprix_df,"\n") apprix_1 = apprix_df.iloc[:2,:] apprix_2 = apprix_df.iloc[2:,:] print("The DataFrames formed by splitting of Apprix Team DataFrame are: ","\n") print(apprix_1,"\n") print(apprix_2,"\n") 输出: Apprix Team DataFrame: Name Post Qualification 0 Anish CEO MBA 1 Rabindra CTO MS 2 Manish System Admin MCA 3 Samir Consultant PhD 4 Binam Engineer BE The DataFrames formed by splitting the Apprix Team DataFrame a

2021-11-23 14:51:59

- 没有更多了 -