Excel での Python の概要

support.microsoft.com

例 1 では、Python plus 演算子を使用して、3 つのテキスト フラグメントから "Hello World" を生成します。 =PY('Hello' + ' ' + 'World',0)

例 2 では、 xl() 関数を使用して Table1 からデータを取得し、その結果を Python オブジェクトとして返します。 =PY("xl(""Table1[#All]"", headers=True)",1)

sample_df = xl("IrisDataSet2[#すべて]", headers=True)

sample_df.describe()
import matplotlib.pyplot as plt
plt.scatter(xl("IrisDataSet3[sepal_length]"), xl("IrisDataSet3[sepal_width]"))
plt.xlabel('sepal_length')
plt.ylabel('sepal_width')
plt.title('Sepal length and width analysis')
sample_df = xl("IrisDataSet4[#すべて]", headers=True)
sample_df.corr(numeric_only=True)
import seaborn as sns
sample_df = xl("IrisDataSet5[#すべて]", headers=True)
pairplot = sns.pairplot(sample_df, vars=["sepal_length", "sepal_width", "petal_length", "petal_width"])
import seaborn as sns
sample_df = xl("IrisDataSet6[#すべて]", headers=True)
sns.regplot(data = sample_df[["sepal_length","petal_length"]], x = "sepal_length", y = "petal_length")