“Importieren Sie alle CSV Python” Code-Antworten

Importieren Sie alle 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)
Gabriel Juri

Importieren Sie alle 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}')
Gabriel Juri

Ähnliche Antworten wie “Importieren Sie alle CSV Python”

Fragen ähnlich wie “Importieren Sie alle CSV Python”

Weitere verwandte Antworten zu “Importieren Sie alle CSV Python” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen