filtering and plotting data

import pandas as pd
from numpy import genfromtxt
import matplotlib.pyplot as plt
import io

path=“uptimerobot-RP&SPublicAvailability-logs.csv”
df=pd.read_csv(path)

df.drop([‘Reason’, ‘Monitor URL’,‘Date-Time’,‘Duration’], axis = 1, inplace = True)
data=df[‘Duration_min’][df[‘Event’]==‘Down’].sum()

data2=genfromtxt(BytesIO(data),delimiter=’,’,dtype=None)
plt.xlabel(‘Down’)
plt.ylabel(‘Duration in min’)
plt.show(data2)

plt.savefig(‘my_figure.png’)

I am having problems to get the graph displayed, any suggestion?Thank you all!

The matplotlib samples all show a call to plot() before show().

So perhaps you need to:

plt.ylabel('Duration in min')
plt.plot()
plt.show(data2)

?

3 Likes

Thank you! Yes, this is the solution. 

df=pd.read_csv(“document.csv”)
data=df[‘Duration_min’][df[‘Event’]==‘Down’]
plt.xlabel(‘number of Downs’)
plt.ylabel(‘Duration in min’)
plt.plot(data)