Last update: 25.04.2020 13:00:57
# 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=GnlPTmXtNF9WFf10JlFYilmbyer6bFUgZfXzQ7J9QDU9s5uT4POeUunKabsLDTIKxsphZ8NhLm4TUw8O2/fXAQ==&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','t33','t34','t35','t36','t37','t38','t39','t40','t41','t42','t43','t44','t45','t46','t47','t48','t49','t50','t51','t52','t53','t54','t55','t56','t57','t58','t59','t60','t61','t62','t63','t64' ]] = 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']] t33=df[['t33']] t34=df[['t34']] t35=df[['t35']] t36=df[['t36']] t37=df[['t37']] t38=df[['t38']] t39=df[['t39']] t40=df[['t40']] t41=df[['t41']] t42=df[['t42']] t43=df[['t43']] t44=df[['t44']] t45=df[['t45']] t46=df[['t46']] t47=df[['t47']] t48=df[['t48']] t49=df[['t49']] t50=df[['t50']] t51=df[['t51']] t52=df[['t52']] t53=df[['t53']] t54=df[['t54']] t55=df[['t55']] t56=df[['t56']] t57=df[['t57']] t58=df[['t58']] t59=df[['t59']] t60=df[['t60']] t61=df[['t61']] t62=df[['t62']] t63=df[['t63']] t64=df[['t64']] #==================================================================== 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(),t33.rolling(12).mean(),t34.rolling(12).mean(),t35.rolling(12).mean(),t36.rolling(12).mean(),t37.rolling(12).mean(),t38.rolling(12).mean(),t39.rolling(12).mean(),t40.rolling(12).mean(),t41.rolling(12).mean(),t42.rolling(12).mean(),t43.rolling(12).mean(),t44.rolling(12).mean(),t45.rolling(12).mean(),t46.rolling(12).mean(),t47.rolling(12).mean(),t48.rolling(12).mean(),t49.rolling(12).mean(),t50.rolling(12).mean(),t51.rolling(12).mean(),t52.rolling(12).mean(),t53.rolling(12).mean(),t54.rolling(12).mean(),t55.rolling(12).mean(),t56.rolling(12).mean(),t57.rolling(12).mean(),t58.rolling(12).mean(),t59.rolling(12).mean(),t60.rolling(12).mean(),t61.rolling(12).mean(),t62.rolling(12).mean(),t63.rolling(12).mean(),t64.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);