SangYC
February 11, 2020, 7:32am
1
When I execute the code of the official website, I get such an error. Why?
code show as follow:
landmarks_frame = pd.read_csv(‘F:\OfficialData\faces\face_landmarks.csv’)
n = 65
img_name = landmarks_frame.iloc[n, 0]
landmarks = landmarks_frame.iloc[n, 1:].as_matrix()
landmarks = landmarks.astype(‘float’).reshape(-1, 2)
print(‘Image name: {}’.format(img_name))
print(‘Landmarks shape: {}’.format(landmarks.shape))
print(‘First 4 Landmarks: {}’.format(landmarks[:4]))
ptrblck
February 12, 2020, 7:16am
2
Which line of code is raising this error and which pandas version are you using?
I just tried to reproduce the issue, but the code works fine using pandas==0.25.3
.
1 Like
SangYC
February 12, 2020, 12:46pm
3
“landmarks = landmarks_frame.iloc[n, 1:].as_matrix()”
The above code runs with errors.
The version of pandas is 1.0.1.
Replace ‘as_matrix()’ with ‘to_numpy()’ and the problem is solved.
1 Like
ptrblck
February 12, 2020, 5:03pm
4
I used the code from the tutorial , which is using np.asarray
and didn’t realize you’ve changed the code.
Anyway, good to hear it’s working now.
DJ007
(DJ)
April 24, 2021, 1:23am
5
thanks, it works for me too