Skip to content

Commit ced5cb2

Browse files
committed
new
1 parent b23b83b commit ced5cb2

File tree

2 files changed

+106
-14659
lines changed

2 files changed

+106
-14659
lines changed

label_tweet.ipynb

+20-18
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
{
1818
"cell_type": "code",
19-
"execution_count": 1,
19+
"execution_count": 3,
2020
"metadata": {},
2121
"outputs": [],
2222
"source": [
@@ -31,14 +31,11 @@
3131
},
3232
{
3333
"cell_type": "code",
34-
"execution_count": 2,
34+
"execution_count": 4,
3535
"metadata": {},
3636
"outputs": [],
3737
"source": [
38-
"df = pd.read_csv(\"G:/Shared drives/Unidad Compartida Pachitos/Data Science Projects Pachitos/HackOff-CompanySentiments/archive (2)/Tweets.csv\")\n",
39-
"df.drop(['tweet_id','airline_sentiment_confidence','negativereason','negativereason_confidence','airline_sentiment_gold','name','negativereason_gold','retweet_count',\n",
40-
"'tweet_coord','tweet_created','tweet_location','user_timezone','airline'], axis = 1, inplace = True)\n",
41-
"df = df.rename(columns = {'airline_sentiment':'original'})"
38+
"#df = pd.read_csv(\"G:/Shared drives/Unidad Compartida Pachitos/Data Science Projects Pachitos/HackOff-CompanySentiments/tesla_sf.csv\")"
4239
]
4340
},
4441
{
@@ -47,14 +44,13 @@
4744
"metadata": {},
4845
"outputs": [],
4946
"source": [
50-
"#data_location = 's3://tweets-hackoff2/Tweets.csv'\n",
51-
"#df = pd.read_csv(data_location)\n",
52-
"#df"
47+
"data_location = 's3://tweets-hackoff2/tesla_sf.csv'\n",
48+
"df = pd.read_csv(data_location)"
5349
]
5450
},
5551
{
5652
"cell_type": "code",
57-
"execution_count": 5,
53+
"execution_count": 6,
5854
"metadata": {},
5955
"outputs": [],
6056
"source": [
@@ -89,7 +85,7 @@
8985
},
9086
{
9187
"cell_type": "code",
92-
"execution_count": 6,
88+
"execution_count": 7,
9389
"metadata": {},
9490
"outputs": [],
9591
"source": [
@@ -98,18 +94,18 @@
9894
},
9995
{
10096
"cell_type": "code",
101-
"execution_count": 7,
97+
"execution_count": 8,
10298
"metadata": {},
10399
"outputs": [
104100
{
105101
"output_type": "execute_result",
106102
"data": {
107103
"text/plain": [
108-
"<__main__.SentimentAnalysisTweets at 0x1e7c26cd2c8>"
104+
"<__main__.SentimentAnalysisTweets at 0x20e6cf84188>"
109105
]
110106
},
111107
"metadata": {},
112-
"execution_count": 7
108+
"execution_count": 8
113109
}
114110
],
115111
"source": [
@@ -118,12 +114,12 @@
118114
},
119115
{
120116
"cell_type": "code",
121-
"execution_count": 8,
117+
"execution_count": 14,
122118
"metadata": {},
123119
"outputs": [],
124120
"source": [
125-
"df_label = pd.DataFrame()\n",
126-
"df_label['text'] = tweet_class.tweets_.loc[(tweet_class.tweets_['flag'] == 'negative'),'text']\n",
121+
"df_label = tweet_class.tweets_.copy()\n",
122+
"df_label.drop(['tweets_clean','sentiment'], axis=1, inplace=True)\n",
127123
"df_label.to_csv('label_tweets.csv', index=False)"
128124
]
129125
},
@@ -132,7 +128,13 @@
132128
"execution_count": null,
133129
"metadata": {},
134130
"outputs": [],
135-
"source": []
131+
"source": [
132+
"# instantiate S3 client and upload to s3\n",
133+
"import boto3\n",
134+
"\n",
135+
"s3 = boto3.resource('s3')\n",
136+
"s3.meta.client.upload_file('label_tweets.csv', 'tweets-hackoff', 'DESIRED_S3_OBJECT_NAME')"
137+
]
136138
}
137139
],
138140
"metadata": {

0 commit comments

Comments
 (0)