I have an age
and gender
columns
in a data frame
I want to examine the birth rate with respect to the information below
"we should be able to say how many children were born over the past year as a fraction of the number of women aged 25-29. Determine this number, and express it as “births per 100,000”.
and death rate with respect to the elderly people age comparations between 65-70 and 70-75. Could you help me to write a python code how can I do that?
birth_woman = (df["Gender"] == "Female")
birth_woman_age = (df["Age"] > 30)
birth_rate = birth_woman_age < 35
birth_rate.count()
birth_woman2 = (df["Gender"] == "Female")
birth_woman_age2 = (df["Age"] > 25)
birth_rate2 = birth_woman_age2 < 30
birth_rate2
Then I will divide each other could you check the code it returns all the observation numbers
CodePudding user response:
Something like this should work :
birth_woman = df[(df["Gender"] == "Female") &
(df["Age"] > 30) &
(df["Age"] < 35)]