python - Specify DataType using read_table() in Pandas -


i loading text file pandas, , have field contains year. want make sure field string when pulled dataframe.

i can seem work if specify exact length of string using code below: df = pd.read_table('myfile.tsv', dtype={'year':'s4'})

is there way without specifying length? need perform action on different columns vary in length.

i believe enabled in 0.12

you can pass str,np.str_,object in place of s4 convert object dtype in event

or after read in

df['year'].astype(object)


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -