Artificial intelligent assistant

無相関検定をしたいのですがやりかたを教えてください import numpy as np import pandas as pd df_maize = pd.read_csv("PSD online data maize.csv", thousands=',')] df_maize.corr() import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from scipy.stats import spearmanr bs=df_maize['Beginning Stocks'].values es=df_maize['Ending Stocks'].values p_value=df_maize.corr[0] TypeError Traceback (most recent call last) <ipython-input-11-9b62ddc60036> in <module> 1 bs=df_maize['Beginning Stocks'].values 2 es=df_maize['Ending Stocks'].values ----> 3 p_value=df_maize.corr[0] TypeError: 'method' object is not subscriptable

`p-value` `scipy.stats.pearsonr()`


import pandas as pd
from scipy.stats import pearsonr

df = pd.DataFrame({'A': range(5),
'B': [x**2 for x in range(5)],
'C': [x**3 for x in range(5)]})

p_value = df.corr(method=lambda x, y: pearsonr(x,y)[1])
print(df)
print(p_value)


**dataframe**

A | B | C
---|---|---
0 | 0 | 0
1 | 1 | 1
2 | 4 | 8
3 | 9 | 27
4 | 16 | 64

**p-value**

| A | B | C
---|---|---|---
A | 1 | 0.00993072 | 0.0341674
B | 0.00993072 | 1 | 0.00174922
C | 0.0341674 | 0.00174922 | 1

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy f22fb362d50872b722138b1d26dfd58d