1
I am a beginner in Python and need a help.
I have a csv file that has only one column with age data.
I need to transform the integers into ranges, like "ate_21_anos", "ate_24_anos", etc.
The problem is that I cannot compare an int and return a string.
If possible, I would like to obtain this result using pandas.
So far, I’ve tried this way:
import pandas as pd
dados = pd.read_csv('Alunos.csv', delimiter=';', usecols=['IDADE_INGRESSO']
for x in dados:
if x <= 21:
return "menor_21"
dados
I know you’re incomplete and wrong, because I’m really new.
Below is a sample of the base I’m using:
Here are the results I want to get:
Thank you, I edited the question. I hope it is now clearer.
– Matheus Macedo