ExcelFile Vs. read_excel in pandas

前端 未结 3 440
闹比i
闹比i 2020-12-08 01:10

I\'m diving into pandas and experimenting around. As for reading data from an Excel file. I wonder what\'s the difference between using ExcelFile to read_excel. Both seem to

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-08 01:49

    ExcelFile.parse is faster.

    Suppose you are reading dataframes in a loop. With ExcelFile.parse you just pass the Excelfile object(xl in your case). So the excel sheet is just loaded once and you use this to get your dataframes. In case of Read_Excel you pass the path instead of Excelfile object. So essentially every time the workbook is loaded again. Makes a mess if your workbook has loads of sheets and tens of thousands of rows.

提交回复
热议问题