6

I have this issue with heatmap from seaborn. I don't know how, but seaborn.heatmap() refuses to take in dataframe, it instead show the mentioned error. Seaborn, matplotlib and pandas is up-to-date and I'm using python 3.10 on Visual Studio. The code is just a sample code from seaborn.heatmap itself:

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
flights = sns.load_dataset("flights")
flights = flights.pivot("month", "year", "passengers")
ax=sns.heatmap(flights)
plt.show()
Dư Huy
  • 65
  • 7
  • Please add a trace of errors. Thanks – Dilettant Dec 05 '21 at 08:49
  • 2
    @Dilettant is this what you want? I'm sorry if I'm mistaken: Stack trace: > File "D:\baitaplaptrinh\lamchoi\PythonApplication1\PythonApplication1\PythonApplication1.py", line 6, in (Current frame) > ax=sns.heatmap(flights) – Dư Huy Dec 05 '21 at 09:12
  • 1
    I've been running into the same issue. It looks like something is setting `np.core.numeric.dtype` to None. When a dtype check occurs (part of Matplotlib's plotting), the `np.core.numeric.dtype()` function is called. Since this has been set to None by *something*, it raises the error you've noted above. Still trying to figure out how this is happening. – Brandon Schabell Jan 11 '22 at 23:10

1 Answers1

8

Use Python 3.9 (or 3.8, 3.7, 3.6) as it seems like both pandas and plt are not quite ready to be used with Python 3.10:

enter image description here

rudolfovic
  • 3,163
  • 2
  • 14
  • 38
  • 2
    I dont know if this is the right one, but in the output, it said:Stack trace: > File "D:\baitaplaptrinh\lamchoi\PythonApplication1\PythonApplication1\PythonApplication1.py", line 6, in (Current frame) > ax=sns.heatmap(flights) – Dư Huy Dec 05 '21 at 09:10
  • 1
    I'd love to, but my reputation is too low, sorry – Dư Huy Dec 05 '21 at 10:27