Last update: 16.10.2020 04:21:36
# 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=E/IWwwi1AWAv3ja6TPQxpXU543lu2wIyN66NswIVspczOzW1SWJbjYpyl3imCUVgPqyeWIfZe3nOfR66nWBHpg==&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','Motorista','setor' ]] = df['Table'].apply(pd.Series) #==================================================================== df["AIDate"] = pd.to_datetime(df["AIDate"]) df.set_index('AIDate', inplace=True) df.head() Motorista=df[['Motorista']] setor=df[['setor']] #==================================================================== df_rm = pd.concat([Motorista.rolling(12).mean(),setor.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);