I tried a lot of diffent methods but I can't get a reasonable xtick labeling. This is the code I wrote.
import pandas as pd
import numpy as np
import matplotlib
import datetime
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
#Line of Code just for importing the .csv Data
df = pd.read_csv('path of the csv file', sep=",", comment='#', decimal='.', parse_dates=True)
xticks = df.time.unique()
table = df.pivot_table("globalpower", index="time", aggfunc=np.mean)
graph = sns.lineplot(df.time, df.globalpower, data=df)
graph.set_xticks(range(0,24))
graph.set_xticklabels(['01:00','02:00','03:00','04:00','05:00','06:00','07:00','08:00','09:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00','24:00' ])
I know there should be a more elegant way to list the Times of the day.
The output looks like this:
I printed the head of my data it looks like this:
Unnamed: 0 date time globalpower voltage globintensity submetering1 submetering2 submetering3
0 1600236 1/1/2010 00:00:00 1.790 240.65 7.4 0.0 0.0 18.0
1 1600237 1/1/2010 00:01:00 1.780 240.07 7.4 0.0 0.0 18.0
2 1600238 1/1/2010 00:02:00 1.780 240.15 7.4 0.0 0.0 19.0
3 1600239 1/1/2010 00:03:00 1.746 240.26 7.2 0.0 0.0 18.0
4 1600240 1/1/2010 00:04:00 1.686 240.12 7.0 0.0 0.0 18.0


