Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

import all csv python

# Needed packages
import glob
import pandas as pd

# Import all csv files
files = glob.glob("Path/*.csv")

# Concatenate them into one Dataframe

df = pd.DataFrame()
for f in files:
    csv = pd.read_csv(f)
    df = df.append(csv)
    print(df)
Comment

import all csv python

# Needed packages
import glob
import pandas as pd

# Import all csv files
files = glob.glob("Path/*.csv")

# Import them as individual Dataframe

count = 0
for f in files:
    count += 1
    exec(f'df_{count} =pd.read_csv(f)')
    print(f'DataFrame: df_{count}')
Comment

PREVIOUS NEXT
Code Example
Python :: generate all combinatinosrs of a list pyton 
Python :: pd dataframe single column rename 
Python :: select all rows in a table flask_ sqlalchemy (python) 
Python :: entropy formula pyhon 
Python :: convert xls to xlsx python 
Python :: python check samplerate of mp3 
Python :: how to reindex columns in pandas 
Python :: how to repeat if statement in python 
Python :: python if 
Python :: datetime.time to seconds 
Python :: python dictionary get keys and values 
Python :: Python check if all elements exist in another list 
Python :: simple jwt 
Python :: insert row in any position pandas dataframe 
Python :: urllib download file to folder 
Python :: python3 lowercase 
Python :: pandas como eliminar filas con valores no nulos en una columna 
Python :: get list with random numbers python 
Python :: even numbers from 1 to 100 in python 
Python :: Python Tkinter Text Widget Syntax 
Python :: pandas .nlargest 
Python :: python max function with lambda 
Python :: jupyter notebook not working 
Python :: python empty constructor 
Python :: python modulus 
Python :: python possible combinations 
Python :: python seaborn color map 
Python :: code to printing a binary search tree in python 
Python :: translate french to english 
Python :: python extract string 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =