简化表类型数据规范化
sandpaper的Python项目详细描述
基本用法
通过阅读documentation了解更多!
fromsandpaperimportSandPaperpaper=SandPaper('my-sandpaper')\ .strip(# strip whitespace from column commentcolumn_filter=r'comment')\ .translate_text({# get group id from column groupr'^group_(\d+)$':'{0}'},column_filter=r'group')\ .translate_date({# normalize date from column date'%Y-%m-%d':'%c','%m-%d':'%c'},column_filter=r'date')# apply sandpaper rules to a source file and write results to a target filepaper.apply('/home/you/source.csv','/home/you/target.csv')