熊猫记录中的破折号后如何使小写字母变大?
python 198
原文标题 :How to make a small letter large after a dash in pandas records?
我在熊猫中有条目,我需要在破折号后将小写字母更改为大写字母。最好将这种变化记录在单独的列中。
示例数据框:
data columns_1
2020-05-20 test-word
需要结果:
data columns_1 columns_2
2020-05-20 test-word Test-Word
我发现可以使用以下方法更改第一个字母:
df['columns_2'] = df['columns_1'].apply(lambda x: x.capitalize())
是否可以在此条目中添加一些内容,或者是否有其他方法可以做到这一点?