Python Forum
Counting of rows in Excel Spreadsheet
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Counting of rows in Excel Spreadsheet
#1
Howdy! Am a newbie, appreciate any guidance shared.

Given an excel with data with rows of information with a Field called cities: Melbourne, Singapore, Kuala Lumpur, New York.

How do I code to generate a graph counting how many entries belong e.g. to Melbourne / Singapore / and all the other cities? Trying for a horizontal or vertical bar chart for display.

Big thanks!

import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np

df = pd.read_excel (r'C:\Users\Data20192020.xlsx')

plt.style.use('seaborn-dark')

plt.plot(df['Cities'].value_counts())
plt.show()
Reply


Messages In This Thread
Counting of rows in Excel Spreadsheet - by dakrantau - Sep-28-2020, 01:36 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Excel Rows to sentences spartak315 0 1,746 Aug-24-2018, 07:48 PM
Last Post: spartak315
  How do I write a line of code into an excel spreadsheet using Python code? Emerogork 2 3,156 Feb-07-2018, 06:54 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020