Skip to content

Instantly share code, notes, and snippets.

@FavioVazquez
Last active November 25, 2017 19:36
Show Gist options
  • Save FavioVazquez/e0de2ecc3d21cc183cfedc28048d79bd to your computer and use it in GitHub Desktop.
Save FavioVazquez/e0de2ecc3d21cc183cfedc28048d79bd to your computer and use it in GitHub Desktop.
# Import optimus
import optimus as op
# Instanciate DataFrameTransfomer
transformer = op.DataFrameTransformer(df)
# Get original dataFrame to show it.
transformer.show()
# Chaining function transformations
transformer.trim_col("*")
.remove_special_chars("*")
.clear_accents("*")
.lower_case("*")
.drop_col("dummyCol")
.date_transform("birth", "yyyyMMdd", "dd-MM-YYYY")
.age_calculate("birth", "dd-MM-YYYY", "clientAge")
.operation_in_type([('product', 'integer', None)])
.lookup('product', str_to_replace='taco', list_str=['taaaccoo'])
.lookup('product', str_to_replace='pizza', list_str=['piza', 'pizzza'])
transformer.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment