Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

10 Minutes to Pandas tutorial - to_numpy() does not exist?

Tags:

python

numpy

Following: https://pandas.pydata.org/pandas-docs/stable/getting_started/10min.html This - df.to_numpy() throws an AttributeError: 'DataFrame' object has no attribute 'to_numpy'

Not sure why.

like image 808
Ankur B. Avatar asked Jan 29 '19 15:01

Ankur B.


People also ask

Which method is used to display the bottom 10 elements of a series?

Pandas tail() method is used to return bottom n (5 by default) rows of a data frame or series.

Can I use Numba with pandas?

Numba can be used in 2 ways with pandas: Specify the engine="numba" keyword in select pandas methods. Define your own Python function decorated with @jit and pass the underlying NumPy array of Series or DataFrame (using to_numpy() ) into the function.

Why is pandas so slow?

Pandas keeps track of data types, indexes and performs error checking — all of which are very useful, but also slow down the calculations. NumPy doesn't do any of that, so it can perform the same calculations significantly faster.


1 Answers

Try df.values instead. This will have the same effect for versions of pandas prior to 0.24.0

like image 86
markuscosinus Avatar answered Sep 22 '22 11:09

markuscosinus