1. Nauka
  2. /
  3. Kursy
  4. /
  5. Wizualizacja danych szeregów czasowych w Pythonie

Connected

ćwiczenie

Dodaj statystyki podsumowujące do wykresu szeregu czasowego

Możliwe jest jednoczesne wyświetlenie wykresu szeregu czasowego i podsumowania liczbowego na jednym wykresie – wystarczy użyć API pandas dla matplotlib wraz z metodą table:

# Plot the time series data in the DataFrame
ax = df.plot()

# Compute summary statistics of the df DataFrame
df_summary = df.describe()

# Add summary table information to the plot
ax.table(cellText=df_summary.values, 
         colWidths=[0.3]*len(df.columns), 
         rowLabels=df_summary.index, 
         colLabels=df_summary.columns, 
         loc='top')

Instrukcje

100 XP

Przejrzyj meat_mean w konsoli – to DataFrame zawierający średnie wartości wszystkich szeregów czasowych z meat.

  • Przypisz wszystkie wartości z meat_mean do argumentu cellText.
  • Przypisz wszystkie wartości z indeksu meat_mean do argumentu rowLabels.
  • Przypisz nazwy kolumn meat_mean do argumentu colLabels.