Bottom Page

Thread Rating:
  • 2 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Concatenate Specific Cell Interval With Pandas
#1
I want to concatenate specific columns and rows of multiple excel file(Like first.xlsx[B13:D13] and second.xlsx[B13:D13]). How can I improve my codes on below?

import os
import pandas as pd


path = os.getcwd()
files = os.listdir("C:\Files");

files_xls = [f for f in files if f[-3:] == 'xls' or 'xlsx']
print(files_xls)


df = pd.concat(map(pd.read_excel, glob.glob(os.path.join('',"C:\Files\*.xls"))),axis=1)

print(df)
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  concatenate mcgrim 1 494 Mar-22-2019, 01:31 PM
Last Post: buran
  Referring to a specific element in Pandas Dataframe Helmi 2 702 Mar-17-2019, 09:12 PM
Last Post: Helmi
  Concatenate multiple csv files Oscarca 1 1,142 Nov-05-2018, 11:18 AM
Last Post: Larz60+
  Write specific rows from pandas dataframe to csv file pradeepkumarbe 3 1,333 Oct-18-2018, 09:33 PM
Last Post: volcano63
  Slicing String cell by cell Vigneshkumarsakthivel 0 746 Sep-02-2018, 05:59 PM
Last Post: Vigneshkumarsakthivel
  extract specific content in a pandas dataframe with a regex? steve1040 0 9,627 Oct-05-2017, 03:17 AM
Last Post: steve1040
  How to concatenate elements of different type in a table cell? Felipe 8 2,169 Jul-07-2017, 10:59 AM
Last Post: Felipe

Forum Jump:


Users browsing this thread: 1 Guest(s)