Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. ST|ZIPCODE|GEO_ID|GEO_TTL|FOOTID_GEO|NAICS2012|NAICS2012_TTL|FOOTID_NAICS|YEAR|EMPSZES|EMPSZES_TTL|ESTAB|ESTAB_F
  2. 01|35004|8610000US35004|35004(MOODY,AL)||00|Total for all sectors||2012|001|All establishments|167|
  3. 01|35004|8610000US35004|35004(MOODY,AL)||00|Total for all sectors||2012|212|Establishments with 1 to 4 employees|91|
  4.  
  5. colclasses = sapply(read.table(edited_data, nrows=1, sep="|", header=T),class)
  6.  
  7. your_data <- fread(edited_data, sep="|", sep2=NULL, nrows=-1L, header=T, na.strings="NA",
  8. stringsAsFactors=FALSE, verbose=FALSE, autostart=30L, skip=-1L, select=NULL,
  9. colClasses=colclasses)
  10.  
  11. original_file = file_path_to_original_file # e.g. "/Users/User/file.dat"
  12. edited_file = file_path_to_new_file # e.g. "/Users/User/file_edited.dat"
  13.  
  14. with open(original_file) as inp:
  15. with open(edited_file, "w") as op:
  16. for line in inp:
  17. op.write(line.replace("<br/>", "")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement