Created
September 18, 2017 07:04
-
-
Save clairezed/c21fb505188f47a68f186e9f1271bee9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import datetime | |
import csv | |
from collections import defaultdict | |
source_file = "tech_grand_est_00.csv" | |
dest_file = "tech_grand_est_01.csv" | |
df = pd.read_csv(source_file, | |
sep=',' , | |
error_bad_lines=False, | |
encoding='iso-8859-1', | |
quoting=csv.QUOTE_NONE | |
) | |
print "Begining ==============================================================" | |
df.columns = df.columns.str.replace('\"','') | |
df.columns = df.columns.str.replace("\r",'') | |
# Verification | |
print df.columns | |
print df[:10] | |
print len(df) | |
# Selection des departements qui intéressent | |
# type des departements pas clair. | |
df = df.loc[df['DEPET'].isin([ | |
88, 54, 55, 57, 67, 68, 70, 52, 10, 51, 8, 90, | |
'88', '54', '55', '57', '67', '68', '70', '52', '10', '51', '8', '08', '90' | |
])] | |
df.to_csv(dest_file, sep=',', encoding='utf-8', index=False) | |
print "Ended ================================================================" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment