-
sort_values和reset_index
new_titanic_survival = titanic_survival.sort_values("Age",ascending=False) print (new_titanic_survival[0:10]) titanic_reindexed = new_titanic_survival.reset_index(drop=True) print(titanic_reindexed.iloc[0:10])
运行结果:
-
自定义函数
# This function returns the hundredth item from a series def hundredth_row(column): # Extract the hundredth item hundredth_item = column
pandas自定义函数
最新推荐文章于 2023-03-22 10:51:32 发布