Top-level functions¶
- load(index: bool | int = 1, header: bool | int = 1, chunksize: int = 5000) Any¶
Loads the selected cell(s) of the active workbook into a pandas DataFrame. If you select a single cell that has adjacent cells, the range is auto-expanded (via current region) and turned into a pandas DataFrame. If you don't have pandas installed, it returns the values as nested lists.
注釈
Only use this in an interactive context like e.g. a Jupyter notebook! Don't use this in a script as it depends on the active book.
Parameters¶
- indexbool or int, default 1
DataFrameのインデックスとして取り込む左側の列の数を定義します。
- headerbool or int, default 1
DataFrameの列名として取り込む上部の列数を定義します。
- chunksizeint, default 5000
Chunks the loading of big arrays.
例¶
>>> import xlwings as xw >>> xw.load()
viewを参考バージョン 0.23.1 で変更.
- view(obj: Any, sheet: Sheet | None = None, table: bool = True, chunksize: int = 5000) None¶
デフォルトでは、新しいワークブックを開き、その最初のシートにオブジェクトを表示します。シートを指定すれば、シートをクリアした上でオブジェクトを表示します。
注釈
Only use this in an interactive context like e.g., a Jupyter notebook! Don't use this in a script as it depends on the active book.
Parameters¶
- objany type with built-in converter
the object to display, e.g. numbers, strings, lists, numpy arrays, pandas DataFrames
- sheetSheet, default None
Sheet オブジェクト。指定がなければ新しいワークブックの最初のシートになります。
- tablebool, default True
表示するオブジェクトがpandas DataFrameなら、Excelのテーブルとしてフォーマットされます。
- chunksizeint, default 5000
Chunks the loading of big arrays.
例¶
>>> import xlwings as xw >>> import pandas as pd >>> import numpy as np >>> df = pd.DataFrame(np.random.rand(10, 4), columns=['a', 'b', 'c', 'd']) >>> xw.view(df)
loadを参考バージョン 0.22.0 で変更.