#import data and using it in google colab, need help
24 messages · Page 1 of 1 (latest)
What part are you struggling with?
so I would like to concatenate this in one big data frame. Those are some .csv and got all the same structure
i have done :
but it's like doing the same thing over and over again, and then i concatenate "df_XXXX" at the end of the process
but i feel that it's possible to make a loop but i don't know how
(i have imported pandas and os)
i don't know if what i'm saying make sense
You have done loops
I'm confused about what you're confused about
Is the output what you expect?
yea i've already done some loop, but i still need to make for each year (and oh boy i've got a lot of years to do -> 1950 - 2020) some separated loops ? my question is (and I dk if it's possible) : Is there a way to not loop for each year file? like doing only one big loop making the same result
sorry if my english is not that good, i'm doing my best ^^'
Can you show your whole file structure
Because you could do some recursive search from some root directory to select all csvs
this is my file structure, i'm working with only five years for now to understand how i'm supposed to do it.
Each year got 3 .csv : one for the amount of rain, one for the temperature (min/max) and one for the wind speed
to give you some context
all of them are in my google drive in one main file = "projet python"
I would try using pathlib's rglob function to recursively find all file paths that match a pattern
Then when you have that whole list of file paths you can loop through that and append each data frame to a list before concating them
Do you think It will still work with the files stored in a gg drive ? (Btw, thank you for your time and your advice !)
I wouldn't know, give it a try bro