python 将某数据框的列的值依照逗号再建立新的列

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 将某数据框的列的值依照逗号再建立新的列相关的知识,希望对你有一定的参考价值。

#References
#https://stackoverflow.com/questions/37600711/pandas-split-column-into-multiple-columns-by-comma

pd.concat([train[['label']], train['input'].str.split(',', expand=True)], axis=1)

以上是关于python 将某数据框的列的值依照逗号再建立新的列的主要内容,如果未能解决你的问题,请参考以下文章