pandas DataFrame 検索


import pandas as pd
data=pd.read_csv('https://kuroneko.koneko.tokyo/demo/python/uriage-Jun.csv')
df=pd.DataFrame(data)

loveit=df.query('商品名 = "電池A"')
print(loveit)
print("個数 =", len(loveit))

loveit=df[df["商品名"] == "電池A"]
print(loveit)
print("個数 =", len(loveit))