Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm trying to get the correlation coefficient of the columns of matrix A through python. However, I can't do it. I keep on getting an

I'm trying to get the correlation coefficient of the columns of matrix A through python. However, I can't do it.

I keep on getting an error saying, "TypeError: unsupported operand type(s) for +: 'float' and 'str'"

Can you please help me with this code.

image text in transcribed

python File Edit Search Source Run Debug Consoles Projects Tools View Help 4.93 GB 93%)1. Sun 6:20 PM a ^ E Spyder (Python 3.6) D 2 @ BO HI c: EF 1& ers Documents /4th Year (First Sem) Thesis Data L. Editor-Users Documents/4th Year (First Sem)/Thesis Data/data1.py Help data.py le datal.py Source Console object 1 import pandas as pd 2 import numpy as np Usage Year (First Sem)/Thesis/Data/FOREX,xls 5df = pd. read excel("/Users/adriand inglasan/Documents/4th 6 A-pd.DataFrame.as matrix(df) Variable explorer File explorer Help 8B= np. corrcoef (A, rowvar-False) Python console 10 print(B) console 1/A ) execfile(filenane, namespace) 12 File "/Users/adriandinglasan/anaconda3/lib/python3.6/site-packages/ spyder/utils/site/sitecustonize.py", line 101, in execfile exec(compile(f.read), filename, "exec', namespace) File "/Users/adriandinglasan/Documents/4th Year (First Sem)/Thesis/ Data/datal.py", line 8, in nodule> B= np. corrcoef (A, rowva rzfalse) File "/Users/adriandinglasan/anaconda3/lib/python3.6/site-packages/ numpy/lib/function base.py", ine 3159, in corrcoef c cov(x, y, rowvar) File "/Users/adriandinglasan/anaconda3/lib/python3.6/site-packages/ numpy/lib/function_base.py", line 3069, in cov weights=w, avg, w, sum= average(x, axis-1, returned=True) File "/Users/adriandingLasan/anaconda3/lib/python3.6/site-packages/ numpy/lib/function_base.py", line 1110, in average avg a.meanlaxis) File "/Users/adriandinglasan/anaconda3/lib/python3.6/site-packages/ numpy/core/_methods.py", line 70, in mean retumr_sum(arr, axis, dtype, out, keepdims) TypeError: unsupported operand type(s) for "float' and 'str. Python console History log Permissions: RW End-of-lines: LF Encoding: ASCI Line: 1 Column: 1 Memory: 54%

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago