# Order CSV by Head

**URL:** <https://discourse.jupyter.org/t/order-csv-by-head/18763>\
**Category:** Notebook\
**Tags:** community, how-to\
**Created:** [April 2, 2023, 1:33am UTC](https://discourse.jupyter.org/t/order-csv-by-head/18763 "2023-04-02T01:33:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian\_Antunez\_N](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/sebastian_antunez_n/32/9535_2.png) [@Sebastian\_Antunez\_N](https://discourse.jupyter.org/u/Sebastian_Antunez_N)\
**Post date:** [April 2, 2023, 1:33am UTC](https://discourse.jupyter.org/t/order-csv-by-head/18763/1 "2023-04-02T01:33:11Z")

</div>

Hello Guys

Again I ask for help, I am new to this Jupyter Notebook topic and I need if you can help in the following:

I have a csv with 1000 records, where it shows data of those enrolled in a course. This has the following columns

Year, Sex, City, Age

I need you to show me, for example, the sum of all those enrolled in each city, and the sum of all those enrolled per year.

Example

Year;Total Register by year  
2014 2

City; Total Register  
Lima 2

The csv show

Year;City; Age; Sex  
2014;Lima;24;Male  
2013;Quito;31;Female  
2014;Santiago;33,Male  
2010;Buenos Aires;38,Female  
2011;Lima;28;Female

So far I have done the following:

import pandas as pd  
import numpy as np  
import matplotlib.pyplot as plt  
from matplotlib import colors  
import seaborn as sb

%matplotlib inline  
plt.rcParams[‘figure.figsize’] = (16, 9)  
plt.style.use(‘ggplot’)

from sklearn.model\_selection import train\_test\_split  
from sklearn.metrics import classification\_report  
from sklearn.metrics import confusion\_matrix  
from sklearn.naive\_bayes import GaussianNB  
from sklearn.feature\_selection import SelectKBest

dataframe = pd.read\_csv(‘Register.csv’,sep=‘;’, header=None,low\_memory=False,encoding=‘latin-1’,on\_bad\_lines=‘skip’)  
dataframe.head(1000)

Is posible your comments of how can i make this order

Thanks

---

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [April 2, 2023, 3:22am UTC](https://discourse.jupyter.org/t/order-csv-by-head/18763/2 "2023-04-02T03:22:13Z")

</div>

This isn’t a Jupyter issue. You’d have the same issue if you were running your code as a script or directly in the interpreter console.  
Read up on how to use Pandas. There’s a lot of resources.
