0

I am trying to open a few excel folders inside a directory and then be able to do stuff with the data (like take the average of one row for three files). My main goal right now is just to be able to display the information in each excel file. I used the following code to do so. But when I display it, it prints out the '0' element to the '29' element...then it skips 30-50 and and it prints out 51-80.

Here is a snip of my output on python:

import numpy as np
import scipy.io as sio
import scipy 
import matplotlib.pyplot as plt
import os
import pandas as pd
from tkinter import filedialog
from tkinter import *
import matplotlib.image as image
import xlsxwriter
import openpyxl
import xlwt
import xlrd

#GUI
root=Tk()
root.withdraw() #closes tkinter window pop-up
path=filedialog.askdirectory(parent=root,title='Choose a file')
path=path+'/'

print('Folder Selected',path)

files=os.listdir(path)
length=len(files)

print('Files inside the folder',files)

Files=[]

for s in os.listdir(path):
    Files.append(pd.read_excel(path+s))

print (Files)
BruceWayne
  • 22,923
  • 15
  • 65
  • 110
  • 4
    I believe it does read the information properly. I think this is just the default behaviour of `pandas` to omit rows when printing to stdout. You are looking for this: https://stackoverflow.com/questions/19124601/is-there-a-way-to-pretty-print-the-entire-pandas-series-dataframe#30691921 – jjj Dec 20 '17 at 19:12

2 Answers2

1

I'm quite sure your data is being correctly read. The dots between rows 29 and 51 show that there is more data there. pandas elides these rows, so your console looks cleaner. If you want to see all the rows, you could use the solution from this answer:

with pd.option_context('display.max_rows', None, 'display.max_columns', 3):
    print(Files)

Where None sets display limit on rows (no limit) and 3 sets display limit on columns. Here you can find more info on options.

jjj
  • 1,067
  • 1
  • 15
  • 30
0

This is actually the standard way to print the data, notice the ellipses between 29 and 51:

29        7.8000     [cont.]
... 
51        12.19999   [cont.]

You can still operate on every row. To get the number of rows in a dataframe, you can call

len(df.index)
Stolson
  • 100
  • 6