Output:functional group A_OS A'_OS A_HOMO- ... μĀ μ𝐵 ̅ t Perovskite
0 RbTaO3 1 1 0.000 ... 0.0000 0.0000 1.0815 1
1 Ba2PrIrO6 2 2 0.000 ... 0.0000 0.0804 0.9957 1
2 Ba2PrOsO6 2 2 0.000 ... 0.0000 0.0786 0.9946 1
3 Ba2SmIrO6 2 2 0.000 ... 0.0000 0.0196 1.0370 1
4 Ba2TbIrO6 2 2 0.000 ... 0.0000 0.0482 1.0172 1
... ... ... ... ... ... ... ... ... ...
1500 Yb2NiMnO6 3 3 0.000 ... 0.0000 0.0571 0.9203 1
1501 Yb2NiRuO6 3 3 0.000 ... 0.0000 0.0250 0.9001 0
1502 GdBaCo2O6 3 2 1.067 ... 0.1193 0.0286 1.0205 1
1503 KLaMnWO6, 1 3 0.555 ... 0.0768 0.0089 1.0202 1
1504 NaTbMnWO6, 1 3 -0.264 ... 0.0439 0.0089 0.9492 1
[1505 rows x 36 columns]
The data set image is also attached.This is the form of data set I have and I want to obtained Pearson's correlation of the file. I am running this in Jupyter Notebook.
The commands are as:
import numpy as np import matplotlib.pyplot as plt #.pyplot is a module import pandas as pd import seaborn as sns x = pd.read_csv("formability_database.csv") R1 = np.corrcoef(x, rowvar=False)The error message is given below:
Error:TypeError Traceback (most recent call last)
<ipython-input-31-3c1804e8149c> in <module>()
----> 1 R1 = np.corrcoef(x, rowvar=False)
2 #print(x.corr())
<__array_function__ internals> in corrcoef(*args, **kwargs)
3 frames
/usr/local/lib/python3.7/dist-packages/numpy/lib/function_base.py in corrcoef(x, y, rowvar, bias, ddof, dtype)
2681 warnings.warn('bias and ddof have no effect and are deprecated',
2682 DeprecationWarning, stacklevel=3)
-> 2683 c = cov(x, y, rowvar, dtype=dtype)
2684 try:
2685 d = diag(c)
<__array_function__ internals> in cov(*args, **kwargs)
/usr/local/lib/python3.7/dist-packages/numpy/lib/function_base.py in cov(m, y, rowvar, bias, ddof, fweights, aweights, dtype)
2516 w *= aweights
2517
-> 2518 avg, w_sum = average(X, axis=1, weights=w, returned=True)
2519 w_sum = w_sum[0]
2520
<__array_function__ internals> in average(*args, **kwargs)
/usr/local/lib/python3.7/dist-packages/numpy/lib/function_base.py in average(a, axis, weights, returned)
378
379 if weights is None:
--> 380 avg = a.mean(axis)
381 scl = avg.dtype.type(a.size/avg.size)
382 else:
/usr/local/lib/python3.7/dist-packages/numpy/core/_methods.py in _mean(a, axis, dtype, out, keepdims, where)
180 if isinstance(ret, mu.ndarray):
181 ret = um.true_divide(
--> 182 ret, rcount, out=ret, casting='unsafe', subok=False)
183 if is_float16_result and out is None:
184 ret = arr.dtype.type(ret)
TypeError: unsupported operand type(s) for /: 'str' and 'int'
Larz60+ write Mar-01-2022, 04:27 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use BBCode on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use BBCode on future posts.