Notepad/enter/Coding Tips (Classical)/Terminal Tips/Languages/Python/tools/Libraries/pandas/common pandas commands.md

38 lines
934 B
Markdown
Raw Normal View History

2023-07-05 18:29:11 +00:00
# Common SQL queries in pandas
Pandas is a way to transform dataframes with the datasets you have so you have got to be comfortable using it. Make sure to import pandas and seaborn. Here are some popular commands. This [website](https://towardsdatascience.com/writing-5-common-sql-queries-in-pandas-90b52f17ad76) was useful for learning about that
- Import packages and load the data
```
# Import packages
import pandas as pd
import seaborn as sns
# Import data
tips = sns.load_dataset('tips')
```
- View top 5 records in the dataset
```
tips.head()
# specify the amount by placing number inside
# the default is 5
tips.head(8)
```
![[Pasted image 20220705203711.png]]
- Filter data
- Sort data
- Aggregate data
- Aggregate data by group
---
More useful data science tutorials:
- [Geospatial data science](https://towardsdatascience.com/six-python-tips-for-geospatial-data-science-4438a531b0bf) and visualizations