文字列操作(置換,切出し)

pythonの標準関数を使った文字列の操作についてです.

文字列の置換

 >>> s = '操作文字列' 
 >>> print(s.replace('文字列', '成功'))
 操作成功 

文字列の切出し

 >>> import pandas as pd
 >>> d = pd.read_csv('https://raw.githubusercontent.com/maruko-rosso/datasciencehenomiti/master/data/d_sales_test.csv')
 >>> d['date'].str.slice(start = 5, stop = 7).head()
 0    7/
 1    7/
 2    7/
 3    7/
 4    7/