29 lines
1011 B
Python
29 lines
1011 B
Python
|
|
import pandas as pd
|
|
import csv
|
|
|
|
path = '/media/colas/SRV/FICHIERS/TRANSFERTS-EQUIPE/CG/FONCIER/CADASTRE/2023/Fichier national FANTOIR (situation avril 2023)/'
|
|
fant = path+'FANTOIR0423'
|
|
lst_dep = ['07','26','38','42']
|
|
|
|
if __name__ == '__main__':
|
|
|
|
df = pd.read_table(fant,chunksize=500000)
|
|
d07 = pd.DataFrame()
|
|
d26 = pd.DataFrame()
|
|
d38 = pd.DataFrame()
|
|
d42 = pd.DataFrame()
|
|
|
|
for d in df:
|
|
d.columns=['tmp']
|
|
d07 = pd.concat([d07,d[d.tmp.str.startswith('070')]])
|
|
d26 = pd.concat([d26,d[d.tmp.str.startswith('260')]])
|
|
d38 = pd.concat([d38,d[d.tmp.str.startswith('380')]])
|
|
d42 = pd.concat([d42,d[d.tmp.str.startswith('420')]])
|
|
|
|
|
|
d07.to_csv(path+'070.txt', header=None, index=None, quoting=csv.QUOTE_NONE)
|
|
d26.to_csv(path+'260.txt', header=None, index=None, quoting=csv.QUOTE_NONE)
|
|
d38.to_csv(path+'380.txt', header=None, index=None, quoting=csv.QUOTE_NONE)
|
|
d42.to_csv(path+'420.txt', header=None, index=None, quoting=csv.QUOTE_NONE)
|