Skip to content Skip to sidebar Skip to footer

Python With Pandas: File Size (44546) Not 512 + Multiple Of Sector Size (512)

After read excel file with pandas, gets the follow warning: key code: pd_obj = pd.read_excel('flie.xls', dtype=str, usecols=usecols, skiprows=3) for idx, row in pd_obj.iterrows()

Solution 1:

This appears to be a normal warning from the underlying XLRD library, and it seems safe to ignore. A pandas issue (#16620) was opened and closed without a conclusive resolution. However, the discussion did provide an alternative that would allow you to suppress the warnings:

from os import devnull
import pandas as pd
import xlrd

wb = xlrd.open_workbook('file.xls', logfile=open(devnull, 'w'))
pd_obj = pd.read_excel(wb, dtype=str, usecols=usecols, skiprows=3, engine='xlrd')

You can read a more detailed analysis of the actual cause of the error on the forum here: https://groups.google.com/forum/m/#!topic/python-excel/6Lue-1mTPSM

Moral of the story: whenever you get a warning you aren't sure about, you should search for the keywords that appear (discard any specific parts like file sizes or local paths). This answer is based on the first two results to show up on Google.

Post a Comment for "Python With Pandas: File Size (44546) Not 512 + Multiple Of Sector Size (512)"