hgrecco / pint-pandas

Pandas support for pint
Other
172 stars 42 forks source link

TypeError: unhashable type: 'numpy.ndarray' #15

Closed nileshpandey1984 closed 3 years ago

nileshpandey1984 commented 5 years ago

Hi,

I totally new to programming and have been trying to learn python on my own since last month. While plotting the graph it give me error "TypeError: unhashable type: 'numpy.ndarray' and I not at sure why. I checked the web for it, it seems like this error was earlier reported and have been answered, However, it looks the soution is not applicable to me.

Here is the code

import numpy as np from pandas.plotting import register_matplotlib_converters import pandas as pd import matplotlib.pyplot as plt from matplotlib.pylab import rcParams from datetime import datetime

rcParams["figure.figsize"] = 10,6

dataset = pd.read_csv("D:\Data Science\supsales1.csv") print(dataset)

dataset["Month"].astype(object) dataset["Sales"].astype(float)

plt.xlabel("Sales") plt.ylabel("Month") plt.plot(dataset)

Below are the Error Messages

C:\Users\Welcome\PycharmProjects\Nilesh\venv\Scripts\python.exe C:/Users/Welcome/PycharmProjects/Nilesh/practice.py Month Sales 0 Jan 951686 1 Feb 2386742 2 Mar 1068704 3 Apr 641233 4 May 1611669 Traceback (most recent call last): File "C:/Users/Welcome/PycharmProjects/Nilesh/practice.py", line 18, in plt.plot(dataset) File "C:\Users\Welcome\PycharmProjects\Nilesh\venv\lib\site-packages\matplotlib\pyplot.py", line 2811, in plot is not None else {}), kwargs) File "C:\Users\Welcome\PycharmProjects\Nilesh\venv\lib\site-packages\matplotlib__init__.py", line 1810, in inner return func(ax, *args, *kwargs) File "C:\Users\Welcome\PycharmProjects\Nilesh\venv\lib\site-packages\matplotlib\axes_axes.py", line 1611, in plot for line in self._get_lines(args, kwargs): File "C:\Users\Welcome\PycharmProjects\Nilesh\venv\lib\site-packages\matplotlib\axes_base.py", line 393, in _grab_next_args yield from self._plot_args(this, kwargs) File "C:\Users\Welcome\PycharmProjects\Nilesh\venv\lib\site-packages\matplotlib\axes_base.py", line 370, in _plot_args x, y = self._xy_from_xy(x, y) File "C:\Users\Welcome\PycharmProjects\Nilesh\venv\lib\site-packages\matplotlib\axes_base.py", line 205, in _xy_from_xy by = self.axes.yaxis.update_units(y) File "C:\Users\Welcome\PycharmProjects\Nilesh\venv\lib\site-packages\matplotlib\axis.py", line 1473, in update_units default = self.converter.default_units(data, self) File "C:\Users\Welcome\PycharmProjects\Nilesh\venv\lib\site-packages\matplotlib\category.py", line 103, in default_units axis.set_units(UnitData(data)) File "C:\Users\Welcome\PycharmProjects\Nilesh\venv\lib\site-packages\matplotlib\category.py", line 169, in init self.update(data) File "C:\Users\Welcome\PycharmProjects\Nilesh\venv\lib\site-packages\matplotlib\category.py", line 186, in update for val in OrderedDict.fromkeys(data): TypeError: unhashable type: 'numpy.ndarray'

Process finished with exit code 1

amine-aboufirass commented 5 years ago

Your question does not appear to have anything to do with pint-pandas. You should probably ask in the pandas or matplotlib issue trackers. They can help you best.