Parse CSV

In [1]:
import pandas as pd
In [2]:
df = pd.read_csv('Output/SchPark01.csv',
            sep = ';',
            na_values = ' ',
            names = ['date', 'time', 'ghi', 'ta'],
            parse_dates = [[0, 1]],
            index_col = 'date_time'
           )
df
Out[2]:
ghi ta
date_time
2011-01-01 00:00:00 0.0 -0.6
2011-01-01 00:15:00 0.0 -0.4
2011-01-01 00:30:00 0.0 -0.5
2011-01-01 00:45:00 0.0 -0.5
2011-01-01 01:00:00 0.0 -0.7
... ... ...
2011-12-31 22:45:00 0.0 7.9
2011-12-31 23:00:00 0.0 7.9
2011-12-31 23:15:00 0.0 8.4
2011-12-31 23:30:00 0.0 8.5
2011-12-31 23:45:00 0.0 8.1

35040 rows × 2 columns

In [3]:
import matplotlib.pyplot as plt
In [4]:
plt.rcParams['figure.figsize'] = [14, 7]
In [5]:
df.plot();
In [6]:
df.resample('M').mean().plot();
In [7]:
import seaborn as sns
In [8]:
sns.heatmap(
        pd.pivot_table(df, values='ghi', index=df.index.time, columns=df.index.dayofyear),
        annot=False);
In [9]:
sns.heatmap(
        pd.pivot_table(df, values='ta', index=df.index.time, columns=df.index.dayofyear),
        annot=False);
In [10]:
# https://stackoverflow.com/a/16345735/6419007
df2 = df.groupby(lambda x: x.time).fillna(method='ffill')
In [11]:
sns.heatmap(
        pd.pivot_table(df2, values='ghi', index=df2.index.time, columns=df2.index.dayofyear),
        annot=False);
In [12]:
sns.heatmap(
        pd.pivot_table(df2, values='ta', index=df2.index.time, columns=df2.index.dayofyear),
        annot=False);
In [13]:
df.ta.mean()
Out[13]:
12.796018797659167
In [14]:
df2.ta.mean()
Out[14]:
12.749155251141579
In [15]:
df.sort_values('ghi', ascending=False).ghi.plot(use_index=False);
In [16]:
df.sort_values('ta', ascending=False).ta.plot(use_index=False);
In [17]:
df.plot(x='ghi', y='ta', xlabel='GHI [W/m²]', ylabel='Temperature', kind='scatter')
Out[17]:
<AxesSubplot:xlabel='GHI [W/m²]', ylabel='Temperature'>
In [ ]: