I would like to create a cat_month column in my expeditions dataframe. This column would contain the mountain category (small, medium or large) and I would like to assign a category according to the height contained in the highpoint_metres column (with quartiles: small = height lower than the first quartile) but I can't manage to do it.
Data:
import pandas as pd
expeditions = pd.read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-09-22/expeditions.csv")
What I've tried :
peaks[cat_monts] =
for peak_id in expeditions :
if "highpoint_metres" < 6226.5 : #1er quartile
return "petite montagne"
elif 6226.5<"highpoint_metres" <7031.25:
return "moyenne montagne"
else :
return "grande montagne"