Python Forum
Concatenate Specific Cell Interval With Pandas
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)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Concatenate 3D arrays paul18fr 1 2,645 Apr-09-2021, 02:49 PM
Last Post: paul18fr
  How to search for specific string in Pandas dataframe Coding_Jam 1 2,433 Nov-02-2020, 09:35 AM
Last Post: PsyPy
  Pandas DataFrame Concatenate problems Kristenl2784 1 1,890 Jul-01-2020, 01:28 AM
Last Post: hussainmujtaba
  concatenate mcgrim 1 2,234 Mar-22-2019, 01:31 PM
Last Post: buran
  Referring to a specific element in Pandas Dataframe Helmi 2 3,200 Mar-17-2019, 09:12 PM
Last Post: Helmi
  Write specific rows from pandas dataframe to csv file pradeepkumarbe 3 5,501 Oct-18-2018, 09:33 PM
Last Post: volcano63
  Slicing String cell by cell Vigneshkumarsakthivel 0 2,394 Sep-02-2018, 05:59 PM
Last Post: Vigneshkumarsakthivel
  Draw Weibull distribution probability function based on Confidence interval farzadtb 1 3,696 Jul-31-2018, 03:21 PM
Last Post: Vysero
  extract specific content in a pandas dataframe with a regex? steve1040 0 13,536 Oct-05-2017, 03:17 AM
Last Post: steve1040
  How to concatenate elements of different type in a table cell? Felipe 8 4,940 Jul-07-2017, 10:59 AM
Last Post: Felipe

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020