LoginSignup
1
1

More than 1 year has passed since last update.

python xlwing関数 指定した標準偏差と中央値で、任意の行・列数のデータを作成する mshmura

Last updated at Posted at 2020-11-29

python の関数

myproject.py
import xlwings as xw
import numpy as np

@xw.func
@xw.ret(expand = "table")
def randstd(mean, std, rows, columns):
    return np.random.normal(mean, std, (int(rows), int(columns)))

excel設定

1.上部の 「UDF MODULEs:」 のところに上記のpythonファイル名(myproject)を入れる。
(※myprojectはexcelファイルと同じフォルダに入っていると仮定)

適当なセルに、任意の中央値、標準偏差、テーブルの行数、列数を書き込む。

xlwing関数設定.png

下記のように関数を入れる。

qita2.png

結果

qita結果.png

以上。

1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1