[英]How to create a table of more than one value in column
I have a pandas dataframe in python with multiple columns. 我在python中有一个带有多列的pandas数据框。 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: 这是我的代码,仅显示RB的列表:
NewTable=Football[Football.Position=='RB']
However I want RB and WR. 但是我想要RB和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! 首先,我要说的是,要使代码更具pythonic性,您应该放弃CamelCase变量! 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')]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.