guglielmosanchini / ClustViz

Visualization of many Clustering Algorithms, via Notebook or GUI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chameleon graphtool.py: A value is trying to be set on a copy of a slice from a DataFrame.

the-beee opened this issue · comments

After running the following command:
df=cluster(data,k=10,knn=10,m=data.shape[0]//100,alpha=1.0,plot=False)
the algorithm shows the following warning but still proceeds naturally. I'm wondering if this is gonna affect the results?

100%|██████████| 2000/2000 [01:01<00:00, 32.58it/s]
Begin clustering...
/home/ayoub/.local/lib/python3.8/site-packages/clustviz/chameleon/graphtools.py:112: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
df["cluster"] = nx.get_node_attributes(graph, "cluster").values()
0%| | 0/76 [00:00<?, ?it/s]/home/ayoub/.local/lib/python3.8/site-packages/pandas/core/indexing.py:966: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
self.obj[item] = s

Hi!
It should not affect the results, anyway, I am going to correct this, thanks for reporting this

With the new version, 0.0.7, the warning should not be printed

Thanks mate!