Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
513 B
2
Indexable
Never
import pandas as pd

df = pd.read_csv('/datasets/vg_sales.csv')
df['user_score'] = pd.to_numeric(df['user_score'], errors='coerce')

developers = ['SquareSoft', 'Enix Corporation', 'Square Enix']
cols = ['name', 'developer', 'na_sales', 'eu_sales', 'jp_sales']

q_string = "na_sales >= 1 or eu_sales >= 1 or jp_sales >= 1"
df_filtered = "(na_sales > 0 and eu_sales > 0 and jp_sales > 0) and (jp_sales > (eu_sales + na_sales)) and isin(cols)"
print(df.query(q_string).head(5))
#print(df.query(df_filtered).head(5))
Leave a Comment