由于某种原因,标头没有被正确推断。您可以像这样传递infer_header
关键字参数:
In [12]: from blaze import Data
In [13]: from odo import CSV, odo
In [14]: d = Data(CSV('uk.txt', sep='\t', has_header=True))
In [15]: d.head(5)
Out[15]:
RC UFI UNI LAT LONG DMS_LAT DMS_LONG \
0 1 380952 475802 54.086111 -6.655556 540510 -63920
1 1 380952 475801 54.086111 -6.655556 540510 -63920
2 1 380954 475805 54.104722 -6.648889 540617 -63856
3 1 380955 475806 54.098056 -6.644167 540553 -63839
4 1 380958 475810 54.040556 -6.614444 540226 -63652
MGRS JOG FC ... SORT_NAME_RG \
0 29UPV5334795644 NN29-06 H ... CLAREBANERIVER
1 29UPV5334795644 NN29-06 H ... CLAREBANE
2 29UPV5371497729 NN29-06 H ... ALINA LOUGH
3 29UPV5404796997 NN29-06 H ... CORLISSLOUGH
4 29UPV5620690667 NN29-06 H ... DRUMBOYLOUGH
FULL_NAME_RG FULL_NAME_ND_RG NOTE MODIFY_DATE DISPLAY NAME_RANK \
0 Clarebane River Clarebane River NaN 2014-06-27 1,2,3 2
1 Clarebane Clarebane NaN 2014-06-27 1,2,3 1
2 Alina, Lough Alina, Lough NaN 2014-06-27 1,2,3 1
3 Corliss Lough Corliss Lough NaN 2014-06-27 1,2,3 1
4 Drumboy Lough Drumboy Lough NaN 2014-06-27 1,2,3 1
NAME_LINK TRANSL_CD NM_MODIFY_DATE
0 NaN NaN 2014-06-27
1 NaN NaN 2014-06-27
2 NaN NaN 2014-06-27
3 NaN NaN 2014-06-27
4 NaN NaN 2014-06-27
[5 rows x 34 columns]
之后,只需odo
将其放入所需的表中:
In [16]: t = odo(d, 'postgresql://localhost::uk')
In [17]: uk = Data(t)
In [19]: uk.head(5)
Out[19]:
RC UFI UNI LAT LONG DMS_LAT DMS_LONG \
0 1 380952 475802 54.086111 -6.655556 540510 -63920
1 1 380952 475801 54.086111 -6.655556 540510 -63920
2 1 380954 475805 54.104722 -6.648889 540617 -63856
3 1 380955 475806 54.098056 -6.644167 540553 -63839
4 1 380958 475810 54.040556 -6.614444 540226 -63652
MGRS JOG FC ... SORT_NAME_RG \
0 29UPV5334795644 NN29-06 H ... CLAREBANERIVER
1 29UPV5334795644 NN29-06 H ... CLAREBANE
2 29UPV5371497729 NN29-06 H ... ALINA LOUGH
3 29UPV5404796997 NN29-06 H ... CORLISSLOUGH
4 29UPV5620690667 NN29-06 H ... DRUMBOYLOUGH
FULL_NAME_RG FULL_NAME_ND_RG NOTE MODIFY_DATE DISPLAY NAME_RANK \
0 Clarebane River Clarebane River NaN 2014-06-27 1,2,3 2
1 Clarebane Clarebane NaN 2014-06-27 1,2,3 1
2 Alina, Lough Alina, Lough NaN 2014-06-27 1,2,3 1
3 Corliss Lough Corliss Lough NaN 2014-06-27 1,2,3 1
4 Drumboy Lough Drumboy Lough NaN 2014-06-27 1,2,3 1
NAME_LINK TRANSL_CD NM_MODIFY_DATE
0 NaN NaN 2014-06-27
1 NaN NaN 2014-06-27
2 NaN NaN 2014-06-27
3 NaN NaN 2014-06-27
4 NaN NaN 2014-06-27
[5 rows x 34 columns]