Open misantroop opened 4 years ago
Thanks @misantroop for the report. This is for NumPy 1.19 onwards?
could you provide a MRE that would be suitable as a test https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports
xref #31201
Thanks @misantroop for the report. This is for NumPy 1.19 onwards?
could you provide a MRE that would be suitable as a test https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports
Correct, issue does not appear in NumPy 1.18.5. I attempted to conform better to MRE guidelines.
The issue can be reproduced with just indexing, so not specific to groupby or shift.
>>> import numpy as np
>>> import pandas as pd
>>>
>>> pd.__version__
'1.1.0rc0+7.g04e9e0afd'
>>>
>>> tup = "A", ("B", 2)
>>>
>>> ser = pd.Series([42], index=[tup])
>>> ser
(A, (B, 2)) 42
dtype: int64
>>>
>>> ser[[tup]]
C:\Users\simon\Anaconda3\envs\pandas-dev\lib\site-packages\numpy\core\_asarray.py:83: VisibleDeprecationWarning: Creating an ndarray from ragge
d nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do
this, you must specify 'dtype=object' when creating the ndarray
return array(a, dtype, copy=False, order=order)
(A, (B, 2)) 42
dtype: int64
>>>
xref #24688
[+] I have checked that this issue has not already been reported.
[+] I have confirmed this bug exists on the latest version of pandas.
[+] (optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
Problem description
Shifting a group that has a column name as tuple-of-tuples gives VisibleDeprecationWarning.
Expected Output
No VisibleDeprecationWarning triggered.
Output of
pd.show_versions()