Created
June 22, 2022 11:12
-
-
Save monocongo/853f49fec2705ab12cd94bfd20b38cf7 to your computer and use it in GitHub Desktop.
Below we demonstrate how to utilize [sbpy](https://sbpy.readthedocs.io/en/latest/index.html) to transform an unpacked designation to packed format
This file contains 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
import pandas as pd | |
from sbpy.data import Names | |
# function to create the new packed format column | |
def pack_designation( | |
row: pd.Series, | |
) -> pd.Series: | |
return pd.Series( | |
data=[Names.to_packed(row.pdes)], | |
index=['Principal_desig'], | |
) | |
... | |
# crete a new column containing the designation in packed format | |
df = df.join(leaderboard_df.apply(pack_designation, axis=1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment