FutureWarning when unpacking a pandas frame (v 0.17)

I recently upgraded to pandas 0.17.0 (numpy: 1.10.1 , Python: 2.7.10), and I get the warning indicated in the block below when I try to change the data form using the unlock operation. The warning appears only for the first time , the code runs on the new ipython laptop. For some reason, a reboot on the same laptop does not cause any messages (!!). A similar gap exists somewhere in the code of a larger application written by the Pycharm editor. In this case, a warning appears every time the application starts.

The result of the deployment of the call looks good, its just a warning that puzzles me, and the expected behavior. An argument is also passed when the stack function is called to prevent a warning from appearing.

Last note: I used pandas 0.15.2 and the code worked smoothly.

Thank you very much

 In [1]: import pandas as pd df = pd.DataFrame([['Maths', 'Student1', 20],['Physics', 'Student2', 21],['Chemistry', 'Student3', 22]], columns=('Subject','Name','Mark')) df = df.set_index(['Subject','Name']) df.unstack() /Users/Name/anaconda/lib/python2.7/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[1]: Mark Name Student1 Student2 Student3 Subject Chemistry NaN NaN 22 Maths 20 NaN NaN Physics NaN 21 NaN 
+5
source share

Source: https://habr.com/ru/post/1235253/


All Articles