rasbt / mlxtend

A library of extension and helper modules for Python's data analysis and machine learning libraries.
https://rasbt.github.io/mlxtend/
Other
4.82k stars 853 forks source link

from mlxtend.plotting import heatmap not running in google colab #1032

Closed andysingal closed 1 year ago

andysingal commented 1 year ago

Hi Sabastian, Thanks for the amazing library, i am having the following challenge running in google colab

from mlxtend.plotting import heatmap

cm = np.corrcoef(df.values.T)
hm = heatmap(cm, row_names = df.columns, column_names = df.columns, figsize = (20, 20))
plt.title('Correlations Between the Different Features of the Data', fontsize = 20)
plt.show()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-38-66b9ffa3ca9c>](https://localhost:8080/#) in <cell line: 4>()
      2 
      3 cm = np.corrcoef(df.values.T)
----> 4 hm = heatmap(cm, row_names = df.columns, column_names = df.columns, figsize = (20, 20))
      5 plt.title('Correlations Between the Different Features of the Data', fontsize = 20)
      6 plt.show()

TypeError: 'module' object is not callable

I was not able to find anyone with same error. I have already tried : !pip uninstall mlxtend and installing: !pip install git+git://github.com/rasbt/mlxtend.git with no success. Looking forward to hearing from you. Thanks, Ankush Singal

rasbt commented 1 year ago

I think this may be a version issue (like here: https://github.com/rasbt/mlxtend/issues/939)

andysingal commented 1 year ago

Still the same issue, scatterplot works fine, the problem is with heatmap as shown in the pic below. I also tried : %%capture !pip install mlxtend --upgrade with no success

Screen Shot 2023-04-27 at 10 54 26 PM
rasbt commented 1 year ago

Hm, sorry, that's weird. I honestly don't have a good explanation for this. I just tried it myself and it seems to work. Maybe restart and try again?

Screenshot 2023-04-27 at 3 00 51 PM
andysingal commented 1 year ago

Works now, i added: import mlxtend

Screen Shot 2023-04-28 at 7 56 49 AM