In [1]:
df = pd.read_csv('data/cog2014.csv', delimiter='\t')
df.set_index('dc', inplace=True)
df['pole'][df.pole.isnull()] = df.index
df


Out[1]:
actual r d ct cheflieu pole tncc nom nomsa
dc
01001 1 82 01 10 0 01001 5 L'Abergement-Clémenciat Abergement-Clémenciat
01002 1 82 01 1 0 01002 5 L'Abergement-de-Varey Abergement-de-Varey
01003 3 82 01 NaN NaN 01165 1 Amareins Amareins
01004 1 82 01 1 1 01004 1 Ambérieu-en-Bugey Ambérieu-en-Bugey
01005 1 82 01 30 0 01005 1 Ambérieux-en-Dombes Ambérieux-en-Dombes
01006 1 82 01 4 0 01006 1 Ambléon Ambléon
01007 1 82 01 1 0 01007 1 Ambronay Ambronay
01008 1 82 01 17 0 01008 1 Ambutrix Ambutrix
01009 1 82 01 4 0 01009 1 Andert-et-Condon Andert-et-Condon
01010 1 82 01 31 0 01010 1 Anglefort Anglefort
01011 1 82 01 22 0 01011 1 Apremont Apremont
01012 1 82 01 15 0 01012 1 Aranc Aranc
01013 1 82 01 28 0 01013 1 Arandas Arandas
01014 1 82 01 23 0 01014 1 Arbent Arbent
01015 1 82 01 4 0 01015 1 Arbignieu Arbignieu
01016 1 82 01 26 0 01016 1 Arbigny Arbigny
01017 1 82 01 28 0 01017 1 Argis Argis
01018 3 82 01 NaN NaN 01033 1 Arlod Arlod
01019 1 82 01 36 0 01019 1 Armix Armix
01020 3 82 01 NaN NaN 01125 1 Arnans Arnans
01021 1 82 01 42 0 01021 1 Ars-sur-Formans Ars-sur-Formans
01022 1 82 01 9 0 01022 1 Artemare Artemare
01023 1 82 01 2 0 01023 1 Asnières-sur-Saône Asnières-sur-Saône
01024 1 82 01 21 0 01024 1 Attignat Attignat
01025 1 82 01 2 0 01025 0 Bâgé-la-Ville Bâgé-la-Ville
01026 1 82 01 2 1 01026 0 Bâgé-le-Châtel Bâgé-le-Châtel
01027 1 82 01 20 0 01027 0 Balan Balan
01028 1 82 01 30 0 01028 0 Baneins Baneins
01029 1 82 01 11 0 01029 0 Beaupont Beaupont
01030 1 82 01 34 0 01030 0 Beauregard Beauregard
... ... ... ... ... ... ... ... ... ...
97412 1 4 974 94 1 97412 0 Saint-Joseph Saint-Joseph
97413 1 4 974 95 1 97413 0 Saint-Leu Saint-Leu
97414 1 4 974 96 1 97414 0 Saint-Louis Saint-Louis
97415 1 4 974 97 2 97415 0 Saint-Paul Saint-Paul
97416 1 4 974 98 2 97416 0 Saint-Pierre Saint-Pierre
97417 1 4 974 26 1 97417 0 Saint-Philippe Saint-Philippe
97418 1 4 974 30 1 97418 0 Sainte-Marie Sainte-Marie
97419 1 4 974 31 1 97419 0 Sainte-Rose Sainte-Rose
97420 1 4 974 32 1 97420 0 Sainte-Suzanne Sainte-Suzanne
97421 1 4 974 33 1 97421 0 Salazie Salazie
97422 1 4 974 99 1 97422 2 Le Tampon Tampon
97423 1 4 974 36 1 97423 4 Les Trois-Bassins Trois-Bassins
97424 1 4 974 22 0 97424 0 Cilaos Cilaos
97601 1 6 976 1 1 97601 1 Acoua Acoua
97602 1 6 976 2 1 97602 0 Bandraboua Bandraboua
97603 1 6 976 3 1 97603 0 Bandrele Bandrele
97604 1 6 976 4 1 97604 0 Bouéni Bouéni
97605 1 6 976 5 1 97605 0 Chiconi Chiconi
97606 1 6 976 6 1 97606 0 Chirongui Chirongui
97607 1 6 976 7 1 97607 0 Dembeni Dembeni
97608 1 6 976 8 4 97608 0 Dzaoudzi Dzaoudzi
97609 1 6 976 9 1 97609 0 Kani-Kéli Kani-Kéli
97610 1 6 976 10 1 97610 0 Koungou Koungou
97611 1 6 976 99 1 97611 0 Mamoudzou Mamoudzou
97612 1 6 976 14 1 97612 0 Mtsamboro Mtsamboro
97613 1 6 976 15 1 97613 0 M'Tsangamouji M'Tsangamouji
97614 1 6 976 16 1 97614 1 Ouangani Ouangani
97615 1 6 976 17 1 97615 0 Pamandzi Pamandzi
97616 1 6 976 18 1 97616 0 Sada Sada
97617 1 6 976 19 1 97617 0 Tsingoni Tsingoni

38264 rows × 9 columns


In [2]:
df.index.is_unique


Out[2]:
True

In [3]:
#st = pd.HDFStore('data/data.h5')
#st['cog2014'] = df
#st.close()

In [4]:
df.to_hdf('data/data.h5','cog2014', format='f')