简体   繁体   中英

How to create a table of more than one value in column

I have a pandas dataframe in python with multiple columns. I can create another list of a certain value in a specific column, but how do I do multiple values within the same column?

Here is my code to display the list for only RB:

NewTable=Football[Football.Position=='RB']

However I want RB and WR. How should I modify my code?

First off i'll say that to make the code more pythonic you should ditch the CamelCase variables! Secondly the question is kind of hard to decipher, if I understand correctly then this should help...

new_table = football[ (football.position == 'RB') & (football.position == ''WR')]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM