I'm using Python and when using the following code
df['timestamp'] = df.groupby(["id"]).timestamp.transform(np.ptp)
I'm getting the warning FutureWarning: Method .ptp is deprecated and will be removed in a future version. Use numpy.ptp instead.
. df
is a Pandas DataFrame and timestamp
and id are columns
. I think np.ptp
is causing this warning.
What do I have to change?
It means that the Method .ptp is being deprecated in favor of (from what I've read) the function np.ptp() so you can either set warnings to false in order to not read it, or replace the method with the function as numpy seems to suggest.
If you wish to supress the warnings, you can try with: warnings.filterwarnings('ignore') or warnings.simplefilter('ignore', FutureWarning) if it's only FutureWarning you are ignoring.