python数据处理——dataframe删除首行并修改index

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/m0_37876745/article/details/88850598
import pandas as pd
df = pd.DataFrame(columns=['open','close'])
df = df.append({'open':1,'close':2},ignore_index=True)
df.loc[len(df)]=[5,6]
df.drop(index=0,inplace=True)
df.reset_index(drop=True,inplace=True)
print(df)

猜你喜欢

转载自blog.csdn.net/m0_37876745/article/details/88850598
今日推荐