I have a small DataFrame that I want to plot using pandas.
2 3
0 1300 1000
1 242751149 199446827
2 237712649 194704827
3 16.2 23.0
I am still trying to learn plotting from within pandas . I want a plot In the above example when I say .
df.plot()
I get the strangest error.
Library/Python/2.7/site-packages/pandas-0.16.2-py2.7-macosx-10.10-intel.egg/pandas/tools/plotting.pyc in _compute_plot_data(self)
1015 if is_empty:
1016 raise TypeError('Empty {0!r}: no numeric data to '
-> 1017 'plot'.format(numeric_data.__class__.__name__))
1018
1019 self.data = numeric_data
TypeError: Empty 'DataFrame': no numeric data to plot
While I understand that the DataFrame with its very lopsided values makes a very un-interesting plot. I am wondering why the error message complains of no numeric data to plot.
To solve this you have to convert the particular column or columns you want to use to numeric. First let me create a simple dataframe with
pandas
andnumpy
to understand it better.Try the following before plotting: