Search code examples
pythonpandasdataframenumpyweather

How to plot values from a dataframe?


I have a dataframe, test, that contains winter temperatures since 1951 for a city. I want to plot the temperatures contained in the column called wintermean but when I try to do that using plt.plot(test.wintermean.values) I get the following error: TypeError: cannot convert the series to <class 'float'>. Here's what test, wintermean, and test.wintermean.values looks like: enter image description here How can I plot this temperature data?


Solution

  • Looks like your DataFrame has a single row and the column value is a pandas.Series. To plot that series, try:

    test["wintermean"].iloc[0].plot()