Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import numpy as np
  2. import pandas as pd
  3.  
  4. temp = pd.DataFrame({
  5. "Luzern": ([1, 5, 9, 15, 20, 25, 25]),
  6. "Basel": ([3, 4, 12, 16, 18, 23, 32]),
  7. "Zuerich": ([8, 6, 10, 17, 23, 22, 24])},
  8. index=["jan", "feb", "mar", "apr", "mai", "jun", "jul"]
  9. )
  10.  
  11. print(temp)
  12.  
  13. # Index resp. Spaltennamen des temp DataFrames ausgeben
  14. print(temp.columns)
  15.  
  16. # Durchscnittstemperatur aller Städte
  17. print(temp.mean())
  18.  
  19. # Alle Temperaturwerte für Basel anzeigen
  20. print(temp.loc[:, "Basel"])
  21.  
  22. # Temperatur im Februar in Luzern
  23. print(temp.loc["feb", "Luzern"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement