Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you please help me figure out this Index Error and what to do to make the code work. It should end up being a

image text in transcribedimage text in transcribedCan you please help me figure out this Index Error and what to do to make the code work. It should end up being a linear regression line with "theta" being a line through it.

Thank you!

theta = np.random.randn(4).reshape(4,1) \#trial and error only worked with a 4 bc the data is in 4 columns i bel \#this is making theta making a 31 vector z=datal[:,0:3] z1=data1[:, [0]] theta = np.linalg pinv(zTez) ez Tez1 theta \#makes the plot plt. scatter (df.loc[[0,18],Filt rate (m3/m2h)],df.loc[[0,18], Actual loss (m)' ]) plt.plot (z[:,[1],z[:,[1]] theta [0]]) \#You likely are using a Series to index an array, and that series likely is not of integer data type. IndexError Traceback (most recent call last) 35 \#makes the plot 36 plt.scatter (df.loc [0,18], Filt rate (m3/m2h) ' ],df.loc[[0,18], 'Actual loss (m) ']) 37 plt.plot (z[:,[1],z[:,[1]]theta[0]]) 38 39 \#use the ac. Y IndexError: arrays used as indices must be of integer (or boolean) type

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

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students also viewed these Databases questions