Skip to content

Instantly share code, notes, and snippets.

@adiamaan92
Created January 27, 2019 17:35
Show Gist options
  • Save adiamaan92/794352132f6e82f36c2cc959d6e10b17 to your computer and use it in GitHub Desktop.
Save adiamaan92/794352132f6e82f36c2cc959d6e10b17 to your computer and use it in GitHub Desktop.
data = load_iris()
iris = pd.DataFrame(data.data, columns=data.feature_names)
(
iris.pipe(csnap, lambda x: x.head(), msg="Before")
.pipe(
setcols,
fn=lambda x: x.columns.str.lower()
.str.replace(r"\(cm\)", "")
.str.strip()
.str.replace(" ", "_"),
)
.pipe(csnap, lambda x: x.head(), msg="After")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment