I am new to Python and statistics. After exploring my car parking data I came up with below trend graph and I want design PDF function which will predict/generate a graph similar to that. My data has two columns "Hour" and "Number of Parking spaces" at that specific "Hour". I have got below graph by taking median number of spaces
Link to the data: https://docs.google.com/spreadsheets/d/1n_IP2IBCWOJuloEwl6fkSOAsZff8o_Nc75JUJrmspf0/edit?usp=sharing
Python code which I have tried:
import matplotlib.pyplot as plt
import scipy
import scipy.stats
import pandas as pd
size = 1368
df = pd.read_csv("D:\Data Analysis\Practicum\DCU car parking "
"data\distribution_creche_parking.csv")
y = df.loc[:, ['Spaces']].values
print y
x= df.loc[:, ['Hour']].values
print x
dist_names = ['gamma', 'beta', 'rayleigh', 'norm', 'pareto']
for dist_name in dist_names:
dist = getattr(scipy.stats, dist_name)
param = dist.fit(y)
print param
pdf_fitted = dist.pdf(x, *param[:-2], loc=param[-2], scale=param[-1]) * size
plt.plot(pdf_fitted, label=dist_name)
plt.xlim(0,23)
plt.legend(loc='upper right')
plt.show()
I tried to use Weibull distribution but my data contains 0 values.