Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

# load multiple csv files into dataframe

# load multiple csv files into dataframe
import glob
import pandas as pd
csv_files = glob.glob("/content/sample_data/*.csv")
df = [pd.read_csv(filename) for filename in csv_files]
Comment

read multiple csv files into separate dataframes python

import os

# current directory csv files
csvs = [x for x in os.listdir('.') if x.endswith('.csv')]
# stats.csv -> stats
fns = [os.path.splitext(os.path.basename(x))[0] for x in csvs]

d = {}
for i in range(len(fns)):
    d[fns[i]] = pd.read_csv(csvs[i])
Comment

PREVIOUS NEXT
Code Example
Python :: shuffle function in python 
Python :: get member by id discord py 
Python :: python order list of dictionaries by value 
Python :: palindrome python 
Python :: pandas append dataframes with same columns 
Python :: the range() function 
Python :: start and end index in python 
Python :: round to 3 significant figures python 
Python :: how to plot using pyplot 
Python :: python oneline if 
Python :: leetcode solutions python 
Python :: TypeError: expected str, bytes or os.PathLike object, not list 
Python :: python list remove all elements 
Python :: sum of the number in a list in python 
Python :: python list tutorial 
Python :: stingray 
Python :: Getting the data type 
Python :: shallow copy deep copy python 
Python :: pip path windows 10 
Python :: adding an item to list in python 
Python :: df.rename(index=str, columns={"A": "a", "C": "c"}) what does index=str means 
Python :: python instagram bot 
Python :: append vector to vector python 
Python :: python string to list without split 
Python :: how to make a calcukatir un python 
Python :: numpy sign method 
Python :: k means clustering python medium 
Python :: data type of none in python 
Python :: receipt ocr 
Python :: min() and max() Function in python 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =