Variable column has different values such as: "Municipal waste generated" and "Recycling" then the Value columns provide values for "Municipal waste generated" and "Recycling". How can I have two different variables such as Municipal waste generated and Recycling?
CodePudding user response:
To get all the rows where Variable
column is either "Recycling" or "Municipal waste generated", you can use query
:
df = # your dataframe
result = df.query('Variable.isin(("Recycling", "Municipal waste generated"))').copy()
result
CodePudding user response: