Skip to content

Instantly share code, notes, and snippets.

@SaraM92
Created September 13, 2020 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SaraM92/3ba6cac1801b20f6de1ef3cc4a18c843 to your computer and use it in GitHub Desktop.
Save SaraM92/3ba6cac1801b20f6de1ef3cc4a18c843 to your computer and use it in GitHub Desktop.
#Import needed library
import pandas as pd
#Dataset
csv = "https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv"
#Load entire dataset
data = pd.read_csv(csv)
data.info(verbose=False, memory_usage="deep")
#Create sub dataset
df = data[["county", "cases"]]
df.info(verbose=False, memory_usage="deep")
#Load only two columns
df_2col = pd.read_csv(csv , usecols=["county", "cases"])
df_2col.info(verbose=False, memory_usage="deep")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment