Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.ExcelFile#

classpandas.ExcelFile(path_or_buffer,engine=None,storage_options=None,engine_kwargs=None)[source]#

Class for parsing tabular Excel sheets into DataFrame objects.

See read_excel for more documentation.

Parameters:
path_or_bufferstr, bytes, path object (pathlib.Path or py._path.local.LocalPath),

A file-like object, xlrd workbook or openpyxl workbook.If a string or path object, expected to be a path to a.xls, .xlsx, .xlsb, .xlsm, .odf, .ods, or .odt file.

enginestr, default None

If io is not a buffer or path, this must be set to identify io.Supported engines:xlrd,openpyxl,odf,pyxlsb,calamineEngine compatibility :

  • xlrd supports old-style Excel files (.xls).

  • openpyxl supports newer Excel file formats.

  • odf supports OpenDocument file formats (.odf, .ods, .odt).

  • pyxlsb supports Binary Excel files.

  • calamine supports Excel (.xls, .xlsx, .xlsm, .xlsb)and OpenDocument (.ods) file formats.

Changed in version 1.2.0:The enginexlrdnow only supports old-style.xls files.Whenengine=None, the following logic will beused to determine the engine:

  • Ifpath_or_buffer is an OpenDocument format (.odf, .ods, .odt),thenodf will be used.

  • Otherwise ifpath_or_buffer is an xls format,xlrd will be used.

  • Otherwise ifpath_or_buffer is in xlsb format,pyxlsb will be used.

Added in version 1.3.0.

  • Otherwise ifopenpyxl is installed,thenopenpyxl will be used.

  • Otherwise ifxlrd>=2.0 is installed, aValueError will be raised.

Warning

Please do not report issues when usingxlrd to read.xlsx files.This is not supported, switch to usingopenpyxl instead.

engine_kwargsdict, optional

Arbitrary keyword arguments passed to excel engine.

Examples

>>>file=pd.ExcelFile('myfile.xlsx')>>>withpd.ExcelFile("myfile.xls")asxls:...df1=pd.read_excel(xls,"Sheet1")

Attributes

book

sheet_names

Methods

close()

close io if necessary

parse([sheet_name, header, names, ...])

Parse specified sheet(s) into a DataFrame.


[8]ページ先頭

©2009-2025 Movatter.jp