Skip to content

Instantly share code, notes, and snippets.

@nikhilkumarsingh
Created September 21, 2018 13:03
Show Gist options
  • Save nikhilkumarsingh/40c1e94d8f7068c1de34cf4a2ea5d32d to your computer and use it in GitHub Desktop.
Save nikhilkumarsingh/40c1e94d8f7068c1de34cf4a2ea5d32d to your computer and use it in GitHub Desktop.
Read CSV files in pandas in lazy manner
reader = pd.read_csv(filename, iterator=True)

## to get first n lines
reader.get_chunk(n)

## to get next n lines and so on
reader.get_chunk(n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment