여러 통화에 국제 통화 기호가있는 Excel 파일 작업. 그 외에도 일부 국제어 파일도 있습니다. 방법은 제거하기 위해 만들어졌습니다 :팬더 데이터 프레임이 국제 통화 기호를 대체합니다.
이 외에도 - (환영보다 더 많은 방법이 더 효율적이있는 경우) 작업을 다음 정리 프로세스가
df = df.apply(lambda x: x.str.replace('\\r',' '))
df = df.apply(lambda x: x.str.replace('\\n',' '))
df = df.apply(lambda x: x.str.replace('\.+', ''))
df = df.apply(lambda x: x.str.replace('-', ''))
df = df.apply(lambda x: x.str.replace('&', ''))
df = df.apply(lambda x: x.str.replace(r"[\"\',]", ''))
df = df.apply(lambda x: x.str.replace('[%*]', ''), axis=1)
을 촬영 한 것처럼
Example: Paying £40.50 doesn't make any sense for a one-hour parking.
Example: Produkty są zbyt drogie (Polish)
Example: 15% de la population féminine n'obtient pas de bons emplois (French)
불용어
def cleanup(row):
stops = set(stopwords.words('english'))
removedStopWords = " ".join([str(i) for i in row.lower().split()
return removedStopWords
데이터 프레임 t의 모든 열에이 방법을 적용하려면
df = df.applymap(self._row_cleaner)['ComplainColumns']
을하지만 가장 큰 문제 UnicodeEncodeError
있다 : 모자는 예 이상 포함되어 있습니다. 영국 파운드시에이 오류가 발생하는 첫 번째 장소 중 하나입니다.
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 646: ordinal not in range(128)
다음 시도 : df = df.apply(lambda x: x.unicode.replace(u'\xa3', ''))
창자가 작동하지 않았다.
목표는 이외의 모든 문자를 바꾸려면 ''
또는 ' '
이렇게하면'df = df.replace ('[^ \ w \ s]', '', regex = True)를 도움이 될까요? – Dark
그것은 모든 것을 w로 바꿔 놓았습니다. –
AttributeError : ("float '객체에'lower '속성이 없습니다. 색인에 u'ccurred가 있습니다.')'내부 정리 메소드'removedStopWords =" ".join ([str (i) for row.lower(). split()이 멈추지 않았다면])' –