df = pd.DataFrame({'cast': [['a, b, c'], ['d, e']]})
df['col'] = df['cast'].str[0].str.replace('\s*,\s*', ' ', regex=True)
print(df)
# Output
cast col
0 [a, b, c] a b c
1 [d, e] d e
旧答案
您可以:
df = pd.DataFrame({'cast': [['a', 'b', 'c'], ['d', 'e']]})
df['col'] = df['cast'].map(' '.join)
print(df)
# Output
cast col
0 [a, b, c] a b c
1 [d, e] d e
1条答案
按热度按时间aurhwmvo1#
更新后:
旧答案
您可以: