what is happening in panda "where" clause

Exposito, Pedro (RIS-MDW) pedro.exposito at lexisnexisrisk.com
Fri Sep 22 09:04:48 EDT 2017


This code does a "where" clause on a panda data frame...

Code:
import pandas as pd;
col_names = ['Name', 'Age', 'Weight', "Education"];
# create panda dataframe
x = pd.read_csv('test.dat', sep='|', header=None, names = col_names);
                # apply "where" condition
z = x[ (x['Age'] == 55) ]
# prints row WHERE age == 55
print (z);

What is happening in this statement:
z = x[ (x['Age'] == 55) ]

Thanks,
Pedro Exposito




---------------------------------------- The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. This message may be an attorney-client communication and/or work product and as such is privileged and confidential. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message.  



More information about the Python-list mailing list