Last update: 03.03.2019 11:26:58
# 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=jzxILO5081Bfz8qoRZLpg5nF0wf+xz1VWyovvGkOEtt9LxkJnko0NhGhTTVqXMq+KpKTwJJdoigFlGSczClidw==&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','Index','Height_in','Weight_pound' ]] = df['Table'].apply(pd.Series) #==================================================================== df["AIDate"] = pd.to_datetime(df["AIDate"]) df.set_index('AIDate', inplace=True) df.head() Index=df[['Index']] Height_in=df[['Height_in']] Weight_pound=df[['Weight_pound']] #==================================================================== df_rm = pd.concat([Index.rolling(12).mean(),Height_in.rolling(12).mean(),Weight_pound.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);