import numpy as np import pandas as pd dates = pd.date_range(‘20200101‘, periods=6) df = pd.DataFrame(np.arange(24).reshape((6, 4)), index=dates, columns=[‘A‘, ‘B‘, ‘C‘, ‘D‘]) print(df)
# 以索引形式进行选择iloc df.iloc[2,2]=1111 print(df)
# 以标签形式进行选择loc df.loc[‘20200102‘, ‘B‘] = 777 print(df)
原文:https://www.cnblogs.com/cropmodel/p/13898561.html