1

I'm trying to convert the specific values within its two columns: 'unemployed' and 'low_wage_jobs', in my data frame: recent_grads.

I tried the following code:

recent_grads_np = recent_grads[['unemployed','low_wage_jobs']].to_numpy()

but then I got the following error message:

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
    recent_grads_np = recent_grads[['unemployed','low_wage_jobs']].to_numpy()
  File "<stdin>", line 3614, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'to_numpy'
Traceback (most recent call last):
  File "script.py", line 2, in <module>
    recent_grads_np = recent_grads[['unemployed','low_wage_jobs']].to_numpy()
  File "script.py", line 3614, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'to_numpy'

why is it? and what should I write?

Sercan
  • 2,081
  • 2
  • 10
  • 23
  • try `.values` instead of `.to_numpy()`. It was deprecated in version 0.24, but it seems your pandas version is older, as it doesn't have `to_numpy` – GPhilo Jun 25 '20 at 12:47

0 Answers0