Skip to content

Instantly share code, notes, and snippets.

@ajitesh123
Created May 27, 2019 17:50
Show Gist options
  • Save ajitesh123/ad5aa4ceedb394fced15bf8d44e4d8cf to your computer and use it in GitHub Desktop.
Save ajitesh123/ad5aa4ceedb394fced15bf8d44e4d8cf to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 336,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"PM Modi has tweeted about Swachh Bharat 14 times.\n",
"--------------------------------\n",
"\n"
]
},
{
"data": {
"text/plain": [
"1248 ‘Swachh Kumbh, Swachh Aabhaar’ was a great pla...\n",
"1252 Addressing the ‘Swachh Kumbh, Swachh Aabhaar’ ...\n",
"1361 You’ve heard of many competitions but we’ve be...\n",
"1367 The Swachh Shakti- 2019 in Haryana’s Kurukshet...\n",
"1661 Here is a unique contest that strengthens the ...\n",
"1684 The Sulabh International family has added imme...\n",
"1840 When Jabalpur has passionate citizens like you...\n",
"2979 The stupendous efforts of the @JagranNews team...\n",
"2988 Thank you @iamsrk, for lending vital support f...\n",
"2991 I congratulate team @ndtv for their notable ef...\n",
"2992 A Swachh Bharat was Bapu's dream. \\n\\nWe are a...\n",
"2994 I congratulate all those who have been conferr...\n",
"3024 A Divyang brother from Rajasthan called me, ex...\n",
"3145 RT @arunjaitley: Sharing my article on Swachh ...\n",
"Name: Tweets, dtype: object"
]
},
"execution_count": 336,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#I'm curious how many times Modi talks about Swachh Bharat. Let's see. \n",
"swachh_count = data.Tweets[data.Tweets.str.contains('Swachh', flags=re.IGNORECASE)].count() \n",
"print(f\"PM Modi has tweeted about Swachh Bharat {swachh_count} times.\")\n",
"print(\"--------------------------------\")\n",
"print()\n",
"data.Tweets[data.Tweets.str.contains('Swachh', flags=re.IGNORECASE)] \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