Skip to content

Commit

Permalink
minor modifs in twitter data analysis notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
mihersch committed Nov 29, 2023
1 parent 75f02b8 commit 83315dc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/ens/enjx2/activ/twitter/twitter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"metadata": {},
"outputs": [],
"source": [
"## pour se mettre dans le bon répértoire\n",
"## pour se mettre dans le bon répértoire \n",
"os.chdir(\"../../../../../Desktop/twitter\")\n",
"print(os.getcwd())"
]
Expand Down Expand Up @@ -292,12 +292,12 @@
"def traitement(tweet): ## le traitement de chaque tweet\n",
" global biden_ios, biden_android, trump_ios, trump_android\n",
" if 'text' in tweet and 'source' in tweet:\n",
" if \"Biden\" in tweet['text'] and not \"Trump\" in tweet['text']: ## la langue est le français\n",
" if \"Biden\" in tweet['text'] and not \"Trump\" in tweet['text']: ## mentionne Biden mais pas Trump\n",
" if 'iPhone' in tweet['source']:\n",
" biden_ios += 1\n",
" if 'Android' in tweet['source']:\n",
" biden_android += 1\n",
" if not \"Biden\" in tweet['text'] and \"Trump\" in tweet['text']: ## la langue est le français\n",
" if not \"Biden\" in tweet['text'] and \"Trump\" in tweet['text']: ## mentionne Trump mais pas Biden\n",
" if 'iPhone' in tweet['source']:\n",
" trump_ios += 1\n",
" if 'Android' in tweet['source']:\n",
Expand Down Expand Up @@ -412,7 +412,7 @@
" for hour in range(24):\n",
" for idx in shortlist:\n",
" timeline[idx].append(0)\n",
" for minute in range(0,60,1): #pour gagner du temps, on ne prend qu'une minute sur trois.\n",
" for minute in range(0,60,3): #pour gagner du temps, on ne prend qu'une minute sur trois.\n",
" fname = datadir+ \"11/\" + format(day,'02d')+ \"/\" + format(hour,'02d') + \"/\" + format(minute,'02d')+\".json\"\n",
" print(fname, end=\"\")\n",
" if os.path.isfile(fname):\n",
Expand Down Expand Up @@ -452,6 +452,8 @@
" plt.plot(timeline[k], label=texts[k])\n",
"plt.legend(loc='center left', bbox_to_anchor=(1, 0.5))\n",
"plt.ylim([0, 30])\n",
"plt.xlabel(\"Heures\")\n",
"plt.ylabel(\"Nombre de retweets\")\n",
"plt.show()\n",
"for k in texts:\n",
" print(texts[k])"
Expand Down

0 comments on commit 83315dc

Please sign in to comment.