部分代码,这个问题怎么实现图片上的结果
import pandas as pd
import numpy as np
dtr=pd.date_range(start='2016-5-20',end='2020-9-7',freq='5d')
df=pd.DataFrame({},index=dtr)
df['营业额']= np.random.randint(200,1000, size=(len(dtr)))
部分代码,这个问题怎么实现图片上的结果
import pandas as pd
import numpy as np
dtr=pd.date_range(start='2016-5-20',end='2020-9-7',freq='5d')
df=pd.DataFrame({},index=dtr)
df['营业额']= np.random.randint(200,1000, size=(len(dtr)))
import pandas as pd
import numpy as np
dtr=pd.date_range(start='2016-5-20',end='2020-9-7',freq='Y')
df=pd.DataFrame({},index=dtr.year)
df['营业额']= np.random.randint(200,1000, size=(len(dtr)))
max_year = df['营业额'].idxmax()
print("每年营业额:")
print(df)
print("营业额最大的年份:{}".format(max_year))