1

From pandas documentation, I found the function to_numpy https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_numpy.html But when I tried it(the same example as in the documentation), I have: 'DataFrame' object has no attribute 'to_numpy'.

Do you know from where could be the problem?

3
  • Welcome to stackoverflow. Please share a minimal reproducible example so we can help with your issue. See: stackoverflow.com/help/minimal-reproducible-example Commented Jun 23, 2020 at 12:59
  • to_numpy() was introduced in Pandas 0.24. On earlier versions, you need to call df.values. Commented Jun 23, 2020 at 13:06
  • What version of pandas are you using? Commented Jun 23, 2020 at 13:10

1 Answer 1

2

The attribute to_numpy() was released with pandas version 0.24.0. Please upgrade your pandas package to use this attribute.

To check the version of pandas within your IDE:

import pandas
print(pandas.__version__)

You may refer this link for upgrading pandas.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.