Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For my Python lab I have to load data with pandas, convert a pandas dataframe to a numpy array and then get the first column
For my Python lab I have to load data with pandas, convert a pandas dataframe to a numpy array and then get the first column and the second to last column from numpy array as vectors. Everything was working fine, but I also have to find the inner product of product of the vectors and I keep getting this error. How do I fix it?
In [2]; import numpy as np import pandas as pd # load data with pandas df = pd.read_csv('/Users/maguireqvale/cars.cvs') #convert a pandas dataframe to a numpy array X = df.values[:, 1:-1] #Get the first column and the second to last column from X as vectors c1 X[:,:1] c2 = X[:,1:] # 3. inner product np.inner (ci, c2) ValueError Traceback (most recent call last)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started