0

I am trying to visualize various FourSquare venues for a specific set of neighborhoods in Paris from the below data frame but am receiving an error message below. Looking for any suggestions, thank you!

Dataframe:

cluster4_df = paris_neighborhood_venue_counts.loc[(paris_neighborhood_venue_counts['Neighborhood'] == '9eme Ardt') | (paris_neighborhood_venue_counts['Neighborhood'] == '1er Ardt') | (paris_neighborhood_venue_counts['Neighborhood'] == '2eme Ardt') | (paris_neighborhood_venue_counts['Neighborhood'] == '4eme Ardt') | (paris_neighborhood_venue_counts['Neighborhood'] == '5eme Ardt') | (paris_neighborhood_venue_counts['Neighborhood'] == '15eme Ardt') | (paris_neighborhood_venue_counts['Neighborhood'] == '10eme Ardt')]

Neighborhood Data frame (cluster4_df)

Displaying the top 15 venues in each Neighborhood:

num_top_venues = 15

for hood in cluster4_df['Neighborhood']:
    print("----"+hood+"----")
    temp = cluster4_df[paris_neighborhood_venue_counts['Neighborhood'] == hood].T.reset_index()
    temp.columns = ['venue','freq']
    temp = temp.iloc[1:]
    temp['freq'] = temp['freq'].astype(int)
    temp = temp.round({'freq': 2})
    print(temp.sort_values('freq', ascending=False).reset_index(drop=True).head(num_top_venues))
    print('\n')

Top 15 venues arrondissement (neighborhood) 10

Stacked Bar Chart Code. This code returns a bar chart but does not ignore 0 values in the histogram.

cluster4_df.dropna()
cluster4_df.plot(kind='bar', figsize=(25, 15), stacked = True)

plt.title('Histogram of Venues in Parisian Arrondissements')
plt.ylabel('Number of Venues')
plt.xlabel('Arrondissement')

plt.show()
  • 2
    **[Don't Post Screenshots](https://meta.stackoverflow.com/questions/303812/)**. Always provide a [mre], with **code, data, errors, current output, and expected output, as [formatted text](https://stackoverflow.com/help/formatting)**. It's likely the question will be down-voted and closed. You're discouraging assistance because no one wants to retype your data or code, and screenshots are often illegible. [edit] the question and **add text**. Please see [How to provide a reproducible copy of your DataFrame using `df.head(15).to_clipboard(sep=',')`](https://stackoverflow.com/questions/52413246). – Trenton McKinney Feb 13 '21 at 19:30
  • 1
    Not sure what is wrong or what you are expecting from the code. But `cluster4_df.dropna()` won't have the desired effect unless you do: `cluster4_df.dropna(inplace=True)` – mullinscr Feb 13 '21 at 19:41

0 Answers0