Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

convert certain columns to string pandas

# column names which need to be string
lst_str_cols = ['prefix', 'serial']
dict_dtypes = {x: 'str' for x in lst_str_cols}
pd.read_csv('sample.csv', dtype=dict_dtypes)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #columns #string #pandas
ADD COMMENT
Topic
Name
3+1 =