2016-08-25 127 views

回答

10

您可以使用str.title

print (df.Column1.str.title()) 
0 The Apple 
1  The Pear 
2 Green Tea 
Name: Column1, dtype: object 

另一個非常類似的方法是str.capitalize,但它轉換爲大寫只有第一個字母:

print (df.Column1.str.capitalize()) 
0 The apple 
1  The pear 
2 Green tea 
Name: Column1, dtype: object 
+0

@jezrael謝謝!奇蹟般有效! –

+0

@JasonChingYuk - 很高興能幫到你! – jezrael

相關問題