Created
September 13, 2020 21:59
-
-
Save SaraM92/808ed30694601e5eada5e283b2275ed7 to your computer and use it in GitHub Desktop.
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
#Import needed libraries | |
import pandas as pd | |
#Dataset | |
csv = "https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv" | |
#Loop different chuncks and get the max of each one | |
result = {} | |
for chunk in pd.read_csv(csv, chunksize=100): | |
max_case = chunk["cases"].max() | |
max_case_county = chunk.loc[chunk['cases'] == max_case, 'county'].iloc[0] | |
result[max_case_county] = max_case | |
#Display results | |
print(max(result, key=result.get) , result[max(result, key=result.get)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment