I used the following questions as sources, listed along with the code I am asking about:
How to get line count cheaply in Python?
def file_len(fname): with open(fname) as f: for i, l in enumerate(f): pass return i + 1 fname = '/path/file.xls' file_len(fname)
This returned 40, when the actual number of lines is 56.
How to count rows in multiple csv file
import glob import pandas as pd files = glob.glob('files/*.xls') d = {f: sum(1 for line in open(f)) for f in files}
This returned 40 for the same file as well, and did not return the correct counts for other files in that path either.
It is not returning an error, and returns the same count consistently across methods, however it is not the correct number of lines.
My question is : What is actually being counted in the .xls files, since it is not the number of lines?