-
-
Save karanjagota/25ec6164f072c7f852460cb6de567f0a to your computer and use it in GitHub Desktop.
gist for my medium blogs ..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -----------xxxxxxxxxxxxxxxx----------------- | |
# Q1. Extract only those rows where column_name: 'mpg' is greater than 30 . | |
df[df['mpg']>30] # or | |
df.loc[df['mpg']>30] | |
# ------------xxxxxxxxxxxxx-------------------- | |
# Q2. Extract only those rows where column_name: 'origin' is equal to 'Asia' | |
df.loc[df['origin']=='Asia'] | |
# -------------------xxxxxxxxxxxxx------------------ | |
# Q3. Select only top 20 rows of the data/dataframe | |
df.iloc[0:20,] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment