Last update: 20.04.2020 21:40:48
# Sample code generated by DasData www.DasData.co import requests import pandas as pd import matplotlib.pyplot as plt plt.style.use('seaborn-whitegrid') import numpy as np %matplotlib inline data_url = 'https://DasData.co/e.aspx?das=vnsztVWDEe3Jc3M3ZzrHL3qlTvBLwXbtNDKL3n0oVJ9DyhhjtFwUG/1m0kpcuHuuOBvXBNj1JaIJHSP7HISq7g==&from=0&to=500&json=1' response = requests.get(data_url, data={"limit" : "500"}) if response.status_code == 200: df = pd.DataFrame.from_records(response.json()) print(df) #==================================================================== df[['id','AIDate','t1','t2','t3','t4','t5','t6','t7','t8','t9','t10','t11','t12','t13','t14','t15','t16','t17','t18','t19','t20','t21','t22','t23','t24','t25','t26','t27','t28','t29','t30','t31','t32' ]] = df['Table'].apply(pd.Series) #==================================================================== df["AIDate"] = pd.to_datetime(df["AIDate"]) df.set_index('AIDate', inplace=True) df.head() t1=df[['t1']] t2=df[['t2']] t3=df[['t3']] t4=df[['t4']] t5=df[['t5']] t6=df[['t6']] t7=df[['t7']] t8=df[['t8']] t9=df[['t9']] t10=df[['t10']] t11=df[['t11']] t12=df[['t12']] t13=df[['t13']] t14=df[['t14']] t15=df[['t15']] t16=df[['t16']] t17=df[['t17']] t18=df[['t18']] t19=df[['t19']] t20=df[['t20']] t21=df[['t21']] t22=df[['t22']] t23=df[['t23']] t24=df[['t24']] t25=df[['t25']] t26=df[['t26']] t27=df[['t27']] t28=df[['t28']] t29=df[['t29']] t30=df[['t30']] t31=df[['t31']] t32=df[['t32']] #==================================================================== df_rm = pd.concat([t1.rolling(12).mean(),t2.rolling(12).mean(),t3.rolling(12).mean(),t4.rolling(12).mean(),t5.rolling(12).mean(),t6.rolling(12).mean(),t7.rolling(12).mean(),t8.rolling(12).mean(),t9.rolling(12).mean(),t10.rolling(12).mean(),t11.rolling(12).mean(),t12.rolling(12).mean(),t13.rolling(12).mean(),t14.rolling(12).mean(),t15.rolling(12).mean(),t16.rolling(12).mean(),t17.rolling(12).mean(),t18.rolling(12).mean(),t19.rolling(12).mean(),t20.rolling(12).mean(),t21.rolling(12).mean(),t22.rolling(12).mean(),t23.rolling(12).mean(),t24.rolling(12).mean(),t25.rolling(12).mean(),t26.rolling(12).mean(),t27.rolling(12).mean(),t28.rolling(12).mean(),t29.rolling(12).mean(),t30.rolling(12).mean(),t31.rolling(12).mean(),t32.rolling(12).mean()], axis=1) #==================================================================== df_rm.plot(figsize=(20,10), linewidth=2, fontsize=15) x = np.linspace(0, 10, 50) plt.xlabel('AIDate', fontsize=12);