Skip to main content

import pandas as pd

import os

os.chdir('...')

#read first file for column names

fdf= pd.read_excel("first_file.xlsx", sheet_name="sheet_name")

#create counter to segregate the different file's data

fdf["counter"]=1

nm= list(fdf)

c=2

#read first 1000 files

for i in os.listdir():

print(c)

if c<1001:

import pandas as pd

import os

os.chdir('...')

#read first file for column names

fdf= pd.read_excel("first_file.xlsx", sheet_name="sheet_name")

#create counter to segregate the different file's data

fdf["counter"]=1

nm= list(fdf)

c=2

#read first 1000 files

for i in os.listdir():

  print(c)

  if c<1001:

    if "xlsx" in i:

      df= pd.read_excel(i, sheet_name="sheet_name")

      df["counter"]=c

      if list(df)==nm:

        fdf=fdf.append(df)

        c+=1

      else:

        print("headers name not match")

    else:

      print("not xlsx") 


fdf=fdf.reset_index(drop=True)

#relax

fdf=fdf.reset_index(drop=True)

#relax

import pandas as pd

import os

os.chdir('...')

#read first file for column names

fdf= pd.read_excel("first_file.xlsx", sheet_name="sheet_name")

#create counter to segregate the different file's data

fdf["counter"]=1

nm= list(fdf)

c=2

#read first 1000 files

for i in os.listdir():

print(c)

if c<1001:

if "xlsx" in i:

  df= pd.read_excel(i, sheet_name="sheet_name")

  df["counter"]=c

  if list(df)==nm:

    fdf=fdf.append(df)

    c+=1

  else:

    print("headers name not match")

else:

  print("not xlsx")

fdf=fdf.reset_index(drop=True)

#relax

import pandas as pd

import os

os.chdir('...')

#read first file for column names

fdf= pd.read_excel("first_file.xlsx", sheet_name="sheet_name")

#create counter to segregate the different file's data

fdf["counter"]=1

nm= list(fdf)

c=2

#read first 1000 files

for i in os.listdir():

  print(c)

  if c<1001:

    if "xlsx" in i:

      df= pd.read_excel(i, sheet_name="sheet_name")

      df["counter"]=c

      if list(df)==nm:

        fdf=fdf.append(df)

        c+=1

      else:

        print("headers name not match")

    else:

      print("not xlsx") 


fdf=fdf.reset_index(drop=True)

#relax
deleted 5 characters in body
Source Link
TBhavnani
  • 781
  • 7
  • 12

import pandas as pd

import os

os.chdir('...')

#read first file for column names

fdf= pd.read_excel("first_file.xlsx", sheet_name="sheet_name")

#create counter to segregate the different file's data

fdf["counter"]=1

nm= list(fdf)

c=2

#read first 1000 files

for i in os.listdir():

print(c)

if c<1001:

if "xlsx" in i:

  df= pd.read_excel(i, sheet_name="All_Transaction"sheet_name="sheet_name")

  df["counter"]=c

  if list(df)==nm:

    fdf=fdf.append(df)

    c+=1

  else:

    print("headers name not match")

else:

  print("not xslx"xlsx")

fdf=fdf.reset_index(drop=True)

#relax

import pandas as pd

import os

os.chdir('...')

#read first file for column names

fdf= pd.read_excel("first_file.xlsx", sheet_name="sheet_name")

#create counter to segregate the different file's data

fdf["counter"]=1

nm= list(fdf)

c=2

#read first 1000 files

for i in os.listdir():

print(c)

if c<1001:

if "xlsx" in i:

  df= pd.read_excel(i, sheet_name="All_Transaction")

  df["counter"]=c

  if list(df)==nm:

    fdf=fdf.append(df)

    c+=1

  else:

    print("headers name not match")

else:

  print("not xslx")

fdf=fdf.reset_index(drop=True)

#relax

import pandas as pd

import os

os.chdir('...')

#read first file for column names

fdf= pd.read_excel("first_file.xlsx", sheet_name="sheet_name")

#create counter to segregate the different file's data

fdf["counter"]=1

nm= list(fdf)

c=2

#read first 1000 files

for i in os.listdir():

print(c)

if c<1001:

if "xlsx" in i:

  df= pd.read_excel(i, sheet_name="sheet_name")

  df["counter"]=c

  if list(df)==nm:

    fdf=fdf.append(df)

    c+=1

  else:

    print("headers name not match")

else:

  print("not xlsx")

fdf=fdf.reset_index(drop=True)

#relax

Source Link
TBhavnani
  • 781
  • 7
  • 12

import pandas as pd

import os

os.chdir('...')

#read first file for column names

fdf= pd.read_excel("first_file.xlsx", sheet_name="sheet_name")

#create counter to segregate the different file's data

fdf["counter"]=1

nm= list(fdf)

c=2

#read first 1000 files

for i in os.listdir():

print(c)

if c<1001:

if "xlsx" in i:

  df= pd.read_excel(i, sheet_name="All_Transaction")

  df["counter"]=c

  if list(df)==nm:

    fdf=fdf.append(df)

    c+=1

  else:

    print("headers name not match")

else:

  print("not xslx")

fdf=fdf.reset_index(drop=True)

#relax