Created
May 27, 2019 02:20
-
-
Save ajitesh123/42106e9f7b21cf9ad289a456c3b351ea 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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 328, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"The mean length of the tweets: 126.94925280199253\n" | |
] | |
} | |
], | |
"source": [ | |
"#Data analysis \n", | |
"mean=np.mean(data['Length'])\n", | |
"print(f\"The mean length of the tweets: {mean}\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 329, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"The most liked tweet is: सबका साथ + सबका विकास + सबका विश्वास = विजयी भारत\n", | |
"\n", | |
"Together we grow. \n", | |
"\n", | |
"Together we prosper. \n", | |
"\n", | |
"Together we will buil… https://t.co/orKx7u7syJ\n", | |
"Number of likes: 422854\n", | |
"------------------\n", | |
"\n", | |
"The most liked tweet is: सबका साथ + सबका विकास + सबका विश्वास = विजयी भारत\n", | |
"\n", | |
"Together we grow. \n", | |
"\n", | |
"Together we prosper. \n", | |
"\n", | |
"Together we will buil… https://t.co/orKx7u7syJ\n", | |
"Number of likes: 121051\n", | |
"------------------\n", | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"#Most liked and retweeted tweets\n", | |
"lik_max=np.max(data['Likes'])\n", | |
"rt_max=np.max(data['RTs'])\n", | |
"\n", | |
"#Extract the index of max\n", | |
"fav=data[data.Likes==lik_max].index[0]\n", | |
"rt=data[data.RTs==rt_max].index[0]\n", | |
"\n", | |
"#Print the result\n", | |
"print(f\"The most liked tweet is: {data['Tweets'][fav]}\")\n", | |
"print(f\"Number of likes: {lik_max}\")\n", | |
"print(\"------------------\")\n", | |
"print()\n", | |
"\n", | |
"#Print the most retweeted tweet\n", | |
"print(f\"The most liked tweet is: {data['Tweets'][rt]}\")\n", | |
"print(f\"Number of likes: {rt_max}\")\n", | |
"print(\"------------------\")\n", | |
"print()\n" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.0" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment