Skip to content

Instantly share code, notes, and snippets.

@shaypal5
Last active June 27, 2022 13:16
Show Gist options
  • Save shaypal5/d19b5e43ed02ed7c718d613e66fb77c9 to your computer and use it in GitHub Desktop.
Save shaypal5/d19b5e43ed02ed7c718d613e66fb77c9 to your computer and use it in GitHub Desktop.
pdpipe first look
>>> df = pd.DataFrame(
data=[[4, 165, 'USA'], [2, 180, 'UK'], [2, 170, 'Greece']],
index=['Dana', 'Jane', 'Nick'],
columns=['Medals', 'Height', 'Born']
)
>>> df
Medals Height Born
Dana 4 165 USA
Jane 2 180 UK
Nick 2 170 Greece
>>> import pdpipe as pdp
>>> pipeline = pdp.ColDrop('Medals').Scale('MinMaxScaler').OneHotEncode('Born')
>>> pipeline(df)
Height Born_UK Born_USA
Dana 0.000000 0 1
Jane 1.000000 1 0
Nick 0.333333 0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment