document_cluster icon indicating copy to clipboard operation
document_cluster copied to clipboard

Issue in the visualisation section when iterating through the dataframe

Open attibalazs opened this issue 9 years ago • 0 comments

Hi, thanks for a great article, i noticed an issue with the following code i had to change this:

#add label in x,y position with the label as the film title
for i in range(len(df)):
    ax.text(df.ix[i]['x'], df.ix[i]['y'], df.ix[i]['title'], size=8)  

to this:


#add label in x,y position with the label as the film title
    for i,r in df.iterrows():
        ax.text(r['x'], r['y'], r['title'], size=8)

This is because earlier in the code, you set the dataframe index to the clusters: df = pd.DataFrame(dict(x=xs, y=ys, label=clusters, title=titles)) Thanks again

attibalazs avatar Jun 22 '16 14:06 attibalazs