Counting of rows in Excel Spreadsheet - Printable Version +- Python Forum ( https://python-forum.io)+-- Forum: Python Coding ( https://python-forum.io/Forum-Python-Coding)+--- Forum: Data Science ( https://python-forum.io/Forum-Data-Science)+--- Thread: Counting of rows in Excel Spreadsheet ( /Thread-Counting-of-rows-in-Excel-Spreadsheet) |

Counting of rows in Excel Spreadsheet - dakrantau - Sep-28-2020
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() RE: Counting of rows in Excel Spreadsheet - jefsummers - Sep-29-2020
df.value_counts() The Docs Pandas has an amazing number of functions and features. Worth spending some time with it. Pandas from the ground up is a youtube video from PyCon 2015. 2.5 hours so it is a time commitment, but IMHO worth it. Video RE: Counting of rows in Excel Spreadsheet - dakrantau - Sep-30-2020
Thanks @jefsummers, got it fixed and thanks for the inspiration! |