Graph Colums from MS SQL Server

Hello Guys

I request your help, I am new to the use of python and I am using jupyter notebook to do a people analysis for a university project

I have a MS SQL Server database, which I bring the values of each table, but I have not been able to get the sum and graph the number of people born in different years (sum) and separate them by sex in a hospital

I have the following columns

YEAR, GENDER, Number_Births_monthly
2020, Female, 1
2020 Male 2
2020, Female, 5
2020, Female, 7
2020 Male 8
2021, Female,3
2021, Male,5
201, Female, 8

I took the file to a csv and grouped them, and I was able to graph, add, how many people were born in the year 2020, for example, of the female sex, with this parameter:
date = df.groupby([‘YEAR’,‘GENDER’]).size()

My problem, I could not find how to do it for MS SQL Server in Jupyter Notebook using pandas

Is possible your help in order to understand how to do the same thing I did with the csv now in SQL.


What currently is in the database?
Do you understand how to connect to the database and retrieve data?
Do you understand how to use SQL generally?
Do you understand what the data you get back will look like?

Where exactly are you stuck?