Skip to content

Instantly share code, notes, and snippets.

@nisrulz
Created June 9, 2017 05:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nisrulz/d1c3367eb3b98763c1fcd9fc82850c38 to your computer and use it in GitHub Desktop.
Save nisrulz/d1c3367eb3b98763c1fcd9fc82850c38 to your computer and use it in GitHub Desktop.
Read and load a csv file into pandas data frame
import pandas as pd
import csv
with open("<filename>.csv", 'r') as f:
with open("updated_file.csv", 'w') as f1:
f.next() # skip header line
f.next() # skip header empty line
for line in f:
f1.write(line.replace('\x00', ''))
df = pd.read_csv('updated_file.csv')
print df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment