Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to combine number of excel files into a single file using python or pandas

import os
import pandas as pd
cwd = os.path.abspath('') 
files = os.listdir(cwd)  
df = pd.DataFrame()
for file in files:
    if file.endswith('.xlsx'):
        df = df.append(pd.read_excel(file), ignore_index=True) 
df.head() 
df.to_excel('total_sales.xlsx')
Comment

PREVIOUS NEXT
Code Example
Python :: color module python 
Python :: reverse list in python 
Python :: new print on the same line substitution python 3 
Python :: minio python create bucket 
Python :: python get dir from path 
Python :: get Fiscal year 
Python :: threadpool python map 
Python :: python remove everything except numbers from string 
Python :: pandas select multiple columns 
Python :: Passing Arrays to Methods 
Python :: python counting up and down 
Python :: mistborn books 
Python :: binary tree python 
Python :: how to omit days pandas datetime 
Python :: access cmd with python 
Python :: pass integer by reference in Python 
Python :: convert string to float python 
Python :: how to import files from desktop to python 
Python :: model.predict knn 
Python :: image deblurring python 
Python :: python pytest no coverage on failure 
Python :: python sounddevice stop recording 
Python :: plot circles in matplotlib 
Python :: search for list of strings in pandas column 
Python :: fillna string 
Python :: Python NumPy stack Function Example with 2d array 
Python :: newsapi 
Python :: how to append a tuple to a list 
Python :: NumPy roll Example 
Python :: create 20 char with python 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =