import pandas as pd
pd.set_option(‘display.unicode.east_asian_width’, True)
data = [51.0, 52.33, 51.21, 54.23, 56.78]
index = [‘2022-2-28’, ‘2022-3-1’, ‘2022-3-2’, ‘2022-3-3’, ‘2022-3-4’]
index = pd.to_datetime(index)
index.name = ‘date’
df = pd.DataFrame(data=data, index=index, columns=[‘昨收’])
print(df)
print(“=========================================”)
df[‘close’] = df[‘昨收’].shift(-1)
df[‘change’] = df[