Skip to content
Untitled Python workspace
  • AI Chat
  • Code
  • Report
  • Spinner
    # import libraries
    import pandas as pd
    import numpy as np
    import matplotlib.pyplot as plt
    import seaborn as sns

    Mean Monthly Temperature in Hamburg

    # import uhh_temp.csv 
    df = pd.read_csv('uhh2000_23temp.csv', sep=";")
    df.head()
    plt.figure(figsize=(10,5))
    sns.lineplot(x='year', y='jan', data=df, label='jan')
    sns.lineplot(x='year', y='feb', data=df, label='feb')
    sns.lineplot(x='year', y='mar', data=df, label='mar')
    sns.lineplot(x='year', y='apr', data=df, label='apr')
    sns.lineplot(x='year', y='may', data=df, label='may')
    sns.lineplot(x='year', y='jun', data=df, label='jun')
    sns.lineplot(x='year', y='jul', data=df, label='jul')
    sns.lineplot(x='year', y='aug', data=df, label='aug')
    sns.lineplot(x='year', y='sep', data=df, label='sep')
    sns.lineplot(x='year', y='oct', data=df, label='oct')
    sns.lineplot(x='year', y='nov', data=df, label='nov')
    sns.lineplot(x='year', y='dec', data=df, label='dec')
    plt.title('Average monthly temperature in Hamburg')
    plt.xlabel('Year')
    plt.ylabel('Temperature in °C')
    plt.show()

    Mean Monthly Rain in Hamburg

    # import uhh_rain.csv
    df2 = pd.read_csv('uhh2000_2023rain.csv', sep=';')
    df2.head()
    plt.figure(figsize=(10,5))
    sns.lineplot(x='year', y='jan', data=df2, label='jan')
    sns.lineplot(x='year', y='feb', data=df2, label='feb')
    sns.lineplot(x='year', y='mar', data=df2, label='mar')
    sns.lineplot(x='year', y='apr', data=df2, label='apr')
    sns.lineplot(x='year', y='may', data=df2, label='may')
    sns.lineplot(x='year', y='jun', data=df2, label='jun')
    sns.lineplot(x='year', y='jul', data=df2, label='jul')
    sns.lineplot(x='year', y='aug', data=df2, label='aug')
    sns.lineplot(x='year', y='sep', data=df2, label='sep')
    sns.lineplot(x='year', y='oct', data=df2, label='oct')
    sns.lineplot(x='year', y='nov', data=df2, label='nov')
    sns.lineplot(x='year', y='dec', data=df2, label='dec')
    plt.title('Average monthly rain in Hamburg')
    plt.xlabel('Year')
    plt.ylabel('rain in mm')
    plt.show()