#import data and using it in google colab, need help

24 messages · Page 1 of 1 (latest)

west apex
#

Do you know how to create a loop to integrate different datasets with different paths from your google drive while concatenating them? all of that using python
don't hesitate to send me a private message.

dense igloo
west apex
#

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

dense igloo
#

You have done loops

#

I'm confused about what you're confused about

#

Is the output what you expect?

west apex
# dense igloo I'm confused about what you're confused about

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 ^^'

dense igloo
#

Because you could do some recursive search from some root directory to select all csvs

west apex
#

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"

dense igloo
#

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

west apex
dense igloo