Created
June 16, 2020 23:59
-
-
Save dzakyputra/10345c9c5d4cdc6bf6b0dbf135b6c161 to your computer and use it in GitHub Desktop.
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
## Transcript preprocessing | |
# Convert the dictionary value into columns and concatenate with the current dataframe | |
value = pd.io.json.json_normalize(transcript['value']) | |
transcript = pd.concat([transcript, value], axis=1).drop(columns=['value']) | |
# Merge the offer_id column and offer id collumn so that it only has one column | |
transcript['offer_id'] = np.where(pd.isnull(transcript['offer_id']), transcript['offer id'], transcript['offer_id']) | |
transcript.drop(columns=['offer id'], inplace=True) | |
# Fill the null values with 0 | |
transcript.fillna(0, inplace=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment