Last active
August 24, 2018 16:43
-
-
Save argenisleon/b6b2fc85b476edc186a9edb5e256ad39 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from optimus import Optimus | |
| op = Optimus() | |
| # This is a custom function | |
| def func(value, arg): | |
| return "this was a number" | |
| df =op.load.url("https://raw.githubusercontent.com/ironmussa/Optimus/master/examples/foo.csv") | |
| df\ | |
| .rows.sort("product","desc")\ | |
| .cols.lower(["firstName","lastName"])\ | |
| .cols.date_transform("birth", "new_date", "yyyy/MM/dd", "dd-MM-YYYY")\ | |
| .cols.years_between("birth", "years_between", "yyyy/MM/dd")\ | |
| .cols.remove_accents("lastName")\ | |
| .cols.remove_special_chars("lastName")\ | |
| .cols.replace("product","taaaccoo","taco")\ | |
| .cols.replace("product",["piza","pizzza"],"pizza")\ | |
| .rows.drop(df["id"]<7)\ | |
| .cols.drop("dummyCol")\ | |
| .cols.rename(str.lower)\ | |
| .cols.apply_by_dtypes("product",func,"string", data_type="integer")\ | |
| .cols.trim("*")\ | |
| .show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment