How do I read multiple files and save them?

Asked

Viewed 35 times

-3

lista = glob.glob('/content/drive/My Drive/LOCAIS/*.xlsx')
lista
df = [pd.read_excel(file)  for file in lista]
df
#melhorar
dados = df[12]
dados

Pmed=dados['Pessoas']
def es(Pmed):
    calc=0.611*np.exp((17.27*Pmed)/(Pmed+237.3))
    return calc

1 answer

0

To read multiple files that follow a pattern in the name, try using something similar to the following example:

import glob 


# Returns a list of names in list files. 
print("Using glob.glob()") 
files = glob.glob('/home/geeks/Desktop/gfg/**/*.txt',  
                   recursive = True) 
for file in files: 
    print(file) 


# It returns an iterator which will  
# be printed simultaneously. 
print("\nUsing glob.iglob()") 
for filename in glob.iglob('/home/geeks/Desktop/gfg/**/*.txt', 
                           recursive = True): 
    print(filename) 

available in: https://www.geeksforgeeks.org/how-to-use-glob-function-to-find-files-recursively-in-python/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.