0

I got a table with a column "win" which has multiple values. Now i want to drop the rows where the value does not match "0" or "5"

for example i did:

result.win.value_counts()

the output of this is:

0.0    183328
5.0    182528
3.0       799
1.0       741
2.0       740
Name: win, dtype: int64

Despite "0" and "5" we have the values "1", "2" and "3" in the columns.

My whole table looks something like this:

   matchid  team    visionscore  win
0    10      1          90.0     0.0
1    10      2         138.0     5.0
2    11      1          84.0     2.0
3    11      2         106.0     5.0
4    12      1          62.0     0.0
5    12      2          80.0     3.0
6    13      1          66.0     0.0
7    13      2          91.0     1.0
..   ..      ..          ...     ...

Now i want to filter the rows, where win != 0 or win != 5, how can i do this?

FloatingGoat
  • 105
  • 1
  • 7
  • 3
    `result.loc[result.win.isin([0,5]),'win']` – anky Jul 08 '19 at 13:47
  • Hey anky, i just specified my question. Your code works but i can't use it on my whole table, it just gives me a df without the other columns. sorry i'm new to python and data analytics – FloatingGoat Jul 08 '19 at 14:04
  • 1
    for the whole dataframe use `result[result.win.isin([0,5])]` no need for specifying specific columns, also you can go trough the docs of [.loc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.loc.html) – anky Jul 08 '19 at 14:05

0 Answers0