Filtering Data in Pandas with Query

preview_player
Показать описание
Filtering data in pandas is super simple using the query method!

#python #coding #datascience

––––––––––––––––––––––––––––––
Creative Commons — Attribution 3.0 Unported — CC BY 3.0
––––––––––––––––––––––––––––––
Рекомендации по теме
Комментарии
Автор

Code is powerful. With the right codes, you can move the world. Thanks

innovationscode
Автор

Thanks for the demo. Adapted for CSV...

import pandas as pd
import csv

df = pd.read_csv("file.csv")


df.head()



df.query('DATE == "2023-02-16"')



df.query('DATE == > 25')



df.query('DATE == "2023-02-16"')\
.query('QUANTITY > 6')\
[['PRODUCT']].value_counts()

gardener_dad
Автор

Nice! Thanks!
ps. Which font are you using for vscode?

LorenzoBaiocco
Автор

2 questions if you don't mind:

1. Does it still load entire dataset in memory, then perform query and store query result in df? Or does this reduce loading times of large datasets as it only loads partial data?

2. I'm also using Jupyter Notebook but I don't see those loading times. How can one enable that? And are those estimated times before running or actual times after running?

giantdutchviking
Автор

Hello, I see this similar to SQL queries. So what is the advantage?

yashvisuals
Автор

I have been learning python and its great, but I still don't see the value of using pandas for data analysis as I can do everything in excel much easier?

MrGreyfoxut
Автор

how can i make the dataframe look tabular and slidable as shown in the video? when i print the dataframe it appears as normal text

et.sachin
Автор

What the difference between the query method and a pandas filter?

manelfb_
Автор

AttributeError: 'list' object has no attribute 'query'

subadevanc