Top-level functions

load(index=1, header=1, chunksize=5000)

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.

パラメータ:
  • index (bool | int) -- DataFrameのインデックスとして取り込む左側の列の数を定義します。

  • header (bool | int) -- DataFrameの列名として取り込む上部の列数を定義します。

  • chunksize (int) -- Chunks the loading of big arrays.

サンプル

>>> import xlwings as xw
>>> xw.load()

See also: view

バージョン 0.23.1 で変更.

view(obj, sheet=None, table=True, chunksize=5000)

デフォルトでは、新しいワークブックを開き、その最初のシートにオブジェクトを表示します。シートを指定すれば、シートをクリアした上でオブジェクトを表示します。

注釈

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.

パラメータ:
  • obj (Any) -- the object to display, e.g. numbers, strings, lists, numpy arrays, pandas DataFrames

  • sheet (Sheet | None) -- Sheet オブジェクト。指定がなければ新しいワークブックの最初のシートになります。

  • table (bool) -- 表示するオブジェクトがpandas DataFrameなら、Excelのテーブルとしてフォーマットされます。

  • chunksize (int) -- 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)

See also: load

バージョン 0.22.0 で変更.