Last active
August 26, 2020 15:07
-
-
Save philshem/1dc727932c990a3230fe38cc83535dad to your computer and use it in GitHub Desktop.
https://twitter.com/dancow/status/1298632074849587204 reply to dancow
This file contains hidden or 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
import pandas as pd | |
# https://burntsushi.net/stuff/worldcitiespop.csv | |
df = pd.read_csv('worldcitiespop.csv',low_memory=False) | |
df = df.query('Country == "us"') | |
print(len(df)) | |
# prints 141989 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Python 3.8.5
Pandas 1.1.1
takes less than 5 seconds on a 2020 macbook i5
slightly optimized code still takes more than 4 seconds:
Approaching 3 seconds with this optimization