May Emanuel
May Emanuel

Reputation: 133

plotting python dateframe column

I am trying to plot the following data frame column

    datum_von  NEG_00_04  NEG_04_08  NEG_08_12  NEG_12_16 NEG_16_20  NEG_20_24
    2017-10-19        7.96       7.14       0.27       1.82       0.50       0.58   
    2017-10-20        7.82       6.50       0.28       1.43       0.49       0.56   
    2017-10-21       10.61       8.51       1.39       2.26       1.73       1.50   
    2017-10-22       18.07      12.92       2.72       7.44       2.04       1.32   
    2017-10-23       10.46       9.73       0.87       1.26       0.72       0.68 

For example, column NEG_00_04

I have tried to do this:

import pyplot as plt
import matplotlib.style
plt.figure()
waps_df1['NEG_04_08'].plot()

getting this error:

traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pyplot
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named style
<matplotlib.figure.Figure object at 0x7efe84608050>
<matplotlib.axes.AxesSubplot object at 0x7efe8477a6d0>
<matplotlib.axes.AxesSubplot object at 0x7efe8477a6d0>
      %html

Upvotes: 1

Views: 53

Answers (2)

cardamom
cardamom

Reputation: 7421

It works for me like this:

%matplotlib inline
waps_df1['NEG_04_08'].plot()

You only need to import pandas to produce a plot, you can lose matplotlib and pyplot. Well that does produce a plot, not sure if it is the kind of plot you want: enter image description here

Upvotes: 1

MarianD
MarianD

Reputation: 14141

Instead of

import pyplot as plt

use

from matplotlib import pyplot as plt

as the module name is matplotlib, not pyplot.

Upvotes: 1

Related Questions