Created
May 19, 2019 21:19
-
-
Save robotenique/a953e7aa0b119a8296af0a90e6d797b2 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
np.random.seed(42) | |
df = (dataset | |
.rename(columns={"Created At": "publication_date", | |
"Text": "tweet", | |
"Retweet Count" : "num_retweets", | |
"Username": "username", | |
"Classificacao": "sentiment"}) | |
.loc[:, ["publication_date", "tweet", "num_retweets", "username", "sentiment"]]) | |
df["publication_date"] = pd.to_datetime(df["publication_date"],infer_datetime_format=True) | |
df["sentiment"] = df["sentiment"].replace({"Negativo": 0, "Neutro": np.random.choice([0, 1]), "Positivo": 1}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment