title: Python - Fitting a GEV distribution from these values
body: <p>I'm very new with Python and I've looked around on the internet, but couldn't find anything logic that could help me with my problem.</p>
  
  <p>I have values of precipitation in a graph, and now I need to fit a GEV distribution from these values in a graph. Each value equals the maximum value of a year, starting from 1974 to 2017 (so there are 43 values total).</p>
  
  <p>These are the values:</p>
  
  <pre><code>max_precip = [9.4, 38.0, 12.5, 35.3, 17.6, 12.9, 12.4, 19.6, 15.0, 13.2, 12.3, 16.9, 16.9, 29.4, 13.6, 11.1, 8.0, 16.6, 12.0, 13.1, 9.1, 9.7, 21.0, 11.2, 14.4, 18.8, 14.0, 19.9, 12.4, 10.8, 21.6, 15.4, 17.4, 14.8, 22.7, 11.5, 10.5, 11.8, 12.4, 16.6, 11.7, 12.9, 17.8]
  </code></pre>
  
  <p>I found that I need to use gev.fit, so I thought using the following:</p>
  
  <pre><code>t = np.linspace(1,43,43)
  fit = gev.fit(max_precip,loc=3)
  pdf = gev.pdf(t, *fit)
  plt.plot(t,pdf)
  plt.plot(t, max_precip, "o")
  </code></pre>
  
  <p>But this only prints the points of max_precip in a graph and not the GEV distribution. </p>
  
  <p>Can someone help me? Sorry if this question is already asked, I couldnt find anything like it.</p>
  
  <p>I used these imports:</p>
  
  <pre><code>import csv
  import matplotlib.pyplot as plt
  import numpy as np
  
  from dateutil.rrule import rrule, YEARLY
  import datetime
  from matplotlib.dates import DateFormatter
  from scipy.stats import genextreme as gev
  from scipy.stats import genpareto as gpd
  from scipy.optimize import minimize
  </code></pre>