Skip to content

Numpy FutureWarning in DataFrame.unstack() #11341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
691175002 opened this issue Oct 16, 2015 · 1 comment
Closed

Numpy FutureWarning in DataFrame.unstack() #11341

691175002 opened this issue Oct 16, 2015 · 1 comment
Labels
Compat pandas objects compatability with Numpy or Python functions Duplicate Report Duplicate issue or pull request

Comments

@691175002
Copy link

Unstacking with an integer level seems to raise a FutureWarning from numpy. I'm using pandas version 0.17.0 and numpy version 1.10.1.

In[14]: d.unstack('ticker')
Out[14]: 
factor      close          open       
ticker        BMO     TD    BMO     TD
date                                  
2005-08-01  61.10  55.90  61.75  56.60
2005-08-02  62.15  56.77  61.18  55.80
2005-08-03  61.40  55.79  61.50  55.49
2005-08-04  59.09  54.81  60.96  55.15
          ...    ...    ...    ...
2015-10-09  75.51  53.25  76.09  53.70
2015-10-12  75.51  53.25  76.09  53.70
2015-10-13  75.35  52.97  75.51  52.95
2015-10-14  74.41  52.37  75.31  53.06
[2663 rows x 4 columns]

In[15]: d.unstack(1)
C:\Anaconda3\envs\pyq\lib\site-packages\pandas\core\index.py:4281: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  return np.sum(name == np.asarray(self.names)) > 1

Out[15]: 
factor      close          open       
ticker        BMO     TD    BMO     TD
date                                  
2005-08-01  61.10  55.90  61.75  56.60
2005-08-02  62.15  56.77  61.18  55.80
2005-08-03  61.40  55.79  61.50  55.49
2005-08-04  59.09  54.81  60.96  55.15
          ...    ...    ...    ...
2015-10-09  75.51  53.25  76.09  53.70
2015-10-12  75.51  53.25  76.09  53.70
2015-10-13  75.35  52.97  75.51  52.95
2015-10-14  74.41  52.37  75.31  53.06
[2663 rows x 4 columns]
@jreback
Copy link
Contributor

jreback commented Oct 16, 2015

this is a known issue, see #8537

pull-requests are welcome!

@jreback jreback closed this as completed Oct 16, 2015
@jreback jreback added Duplicate Report Duplicate issue or pull request Compat pandas objects compatability with Numpy or Python functions labels Oct 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions Duplicate Report Duplicate issue or pull request
Projects
None yet
Development

No branches or pull requests

2 participants