Skip to content

Commit b77e9ec

Browse files
committed
Upgrade to latest client library, with new date helper #3
1 parent 779938b commit b77e9ec

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

MC02 - attention.ipynb

+10-3
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@
7272
"# but that date syntax is kind of ugly, so we have a helper to produce it for you from python dates\n",
7373
"import datetime\n",
7474
"start_date = datetime.date(2019,1,1)\n",
75-
"end_date = datetime.date(2020,1,1)\n",
76-
"date_range_2019 = mc.publish_date_query(start_date, end_date) # default is start inclusive, end exclusive\n",
75+
"end_date = datetime.date(2019,12,31)\n",
76+
"date_range_2019 = mc.dates_as_query_clause(start_date, end_date) # default is start & end inclusive\n",
7777
"mc.storyCount(my_query, date_range_2019)"
7878
]
7979
},
@@ -240,7 +240,7 @@
240240
"outputs": [],
241241
"source": [
242242
"# let's fetch all the stories matching our query (this can take a few minutes)\n",
243-
"jan_2020 = mc.publish_date_query(datetime.date(2020,1,1), datetime.date(2020,2,1))\n",
243+
"jan_2020 = mc.dates_as_query_clause(datetime.date(2020,1,1), datetime.date(2020,1,31))\n",
244244
"all_stories = all_matching_stories(mc, us_query, jan_2020)\n",
245245
"len(all_stories)"
246246
]
@@ -293,6 +293,13 @@
293293
"import pandas\n",
294294
"pandas.read_csv('story-list.csv')"
295295
]
296+
},
297+
{
298+
"cell_type": "code",
299+
"execution_count": null,
300+
"metadata": {},
301+
"outputs": [],
302+
"source": []
296303
}
297304
],
298305
"metadata": {

MC03 - language.ipynb

+2-4
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@
4848
"source": [
4949
"import datetime\n",
5050
"my_query = '\"climate change\" and media_id:2'\n",
51-
"start_date = datetime.date(2019,1,1)\n",
52-
"end_date = datetime.date(2020,1,1)\n",
53-
"date_range_2019 = mc.publish_date_query(start_date, end_date) # default is start inclusive, end exclusive"
51+
"date_range_2019 = mc.dates_as_query_clause(datetime.date(2019,1,1), datetime.date(2019,1,31)) # inclusive"
5452
]
5553
},
5654
{
@@ -88,7 +86,7 @@
8886
"outputs": [],
8987
"source": [
9088
"# check how many stories were about this issue\n",
91-
"jan_2019 = mc.publish_date_query(datetime.date(2019,1,1), datetime.date(2019,2,1))\n",
89+
"jan_2019 = mc.dates_as_query_clause(datetime.date(2019,1,1), datetime.date(2019,1,31))\n",
9290
"story_count = mc.storyCount(my_query, jan_2019)['count']\n",
9391
"story_count"
9492
]

MC04 - entities.ipynb

+1-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@
4444
"source": [
4545
"import datetime\n",
4646
"us_query = '\"climate change\" and tags_id_media:34412234'\n",
47-
"start_date = datetime.date(2019,1,1)\n",
48-
"end_date = datetime.date(2020,1,1)\n",
49-
"date_range_2019 = mc.publish_date_query(start_date, end_date) # default is start inclusive, end exclusive"
47+
"date_range_2019 = mc.dates_as_query_clause(datetime.date(2019,1,1), datetime.date(2019,1,31)) # inclusive"
5048
]
5149
},
5250
{

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mediacloud==3.11.*
1+
mediacloud==3.12.*
22
numpy==1.18.*
33
pandas==1.0.*
44
bokeh==2.0.*

0 commit comments

Comments
 (0)