-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtexting.py
More file actions
27 lines (23 loc) · 799 Bytes
/
Copy pathtexting.py
File metadata and controls
27 lines (23 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import re
import pandas as pd
from unicodedata import normalize
# This module contains methods to make easier ETL steps on commons data analysis
# cases such as pivoting, cleaning, formatting using numpy arrays and pandas
# Series and DataFrames
def RemoveAcentos(word: str)->str:
return normalize('NFKD', word).encode('ASCII', 'ignore').decode('ASCII')
def CamelCase(word:str, keeplist={})->str:
"""Converte texto para o formato camelcase
"""
print(word)
temp = RemoveAcentos(word)
print(temp)
temp = sub('[\(\)]+','', temp)
print(temp)
if len(keeplist):
temp = ''.join([w.title() if w not in keeplist else w for w in temp.split(' ')])
else:
temp = ''.join([w.title() for w in temp.split(' ')])
print(temp)
return temp