Skip to content

Instantly share code, notes, and snippets.

@Abhayparashar31
Last active September 12, 2022 06:47
Show Gist options
  • Save Abhayparashar31/71656bcbb0eab33b22b0cd9c178c7c02 to your computer and use it in GitHub Desktop.
Save Abhayparashar31/71656bcbb0eab33b22b0cd9c178c7c02 to your computer and use it in GitHub Desktop.
from zipfile import ZipFile
import pandas as pd
from pathlib import Path
def get_data(file):
if file is not None:
with ZipFile(file,"r") as zipobj:
zipobj.extractall("data")
for p in Path("./data").glob("*.csv"):
connections_csv = p.name
df = pd.read_csv(f'data/{connections_csv}',skiprows=3) ## skipping top 3 rows containing redundant data
return df
df = get_data('Basic_LinkedInDataExport_06-10-2022.zip')d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment