You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add (implicit) handling for torch tensors in is_scalar (#14623)
PyTorch tensors advertise that they support the number API, and hence answer "True" to the question pd.api.types.is_scalar(torch_tensor). This trips up some of our data ingest, since in as_index we check if the input is a scalar (and raise) before handing off to as_column. To handle this, if we get True back from pandas' is_scalar call, additionally check that the object has an empty shape attribute (if it exists).
See also:
- pytorch/pytorch#99646
- pandas-dev/pandas#52701
Authors:
- Lawrence Mitchell (https://github.com/wence-)
Approvers:
- Ashwin Srinath (https://github.com/shwina)
URL: #14623
0 commit comments