Skip to content

Issue in the visualisation section when iterating through the dataframe #8

Description

@attibalazs

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions