Skip to content

Instantly share code, notes, and snippets.

@zrhans
Created June 19, 2016 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zrhans/519acb269cc68cf1184328d41625f123 to your computer and use it in GitHub Desktop.
Save zrhans/519acb269cc68cf1184328d41625f123 to your computer and use it in GitHub Desktop.
import pandas as pd
sales = [('account', ['Jones LLC', 'Alpha Co', 'Blue Inc', 'Mega Corp']),
('Total Sales', [150, 200, 75, 300]),
('Country', ['US', 'UK', 'US', 'US'])]
df = pd.DataFrame.from_items(sales)
indices = [True, False, True, True]
df[indices]
df.Country == 'US'
# Faz o mesmo filtro no dataframe df
df[df["Country"] == 'US']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment