You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you try putting this URL into your web browser, you'll actually find that the server
1429
1430
responds to your request with some text:
1430
-
```
1431
-
{"date":"2023-07-13","explanation":"A mere 390 light-years away, Sun-like stars and future planetary systems are forming in the Rho Ophiuchi molecular cloud complex, the closest star-forming region to our fair planet. The James Webb Space Telescope's NIRCam peered into the nearby natal chaos to capture this infrared image at an inspiring scale. The spectacular cosmic snapshot was released to celebrate the successful first year of Webb's exploration of the Universe. The frame spans less than a light-year across the Rho Ophiuchi region and contains about 50 young stars. Brighter stars clearly sport Webb's characteristic pattern of diffraction spikes. Huge jets of shocked molecular hydrogen blasting from newborn stars are red in the image, with the large, yellowish dusty cavity carved out by the energetic young star near its center. Near some stars in the stunning image are shadows cast by their protoplanetary disks.","hdurl":"https://apod.nasa.gov/apod/image/2307/STScI-01_RhoOph.png","media_type":"image","service_version":"v1","title":"Webb's Rho Ophiuchi","url":"https://apod.nasa.gov/apod/image/2307/STScI-01_RhoOph1024.png"}
1432
-
```
1433
1431
1434
-
Woah! What a mess! There is definitely some data there, but it's a bit hard to
1432
+
```json
1433
+
{"date":"2023-07-13","explanation":"A mere 390 light-years away, Sun-like stars
1434
+
and future planetary systems are forming in the Rho Ophiuchi molecular cloud
1435
+
complex, the closest star-forming region to our fair planet. The James Webb
1436
+
Space Telescope's NIRCam peered into the nearby natal chaos to capture this
1437
+
infrared image at an inspiring scale. The spectacular cosmic snapshot was
1438
+
released to celebrate the successful first year of Webb's exploration of the
1439
+
Universe. The frame spans less than a light-year across the Rho Ophiuchi region
1440
+
and contains about 50 young stars. Brighter stars clearly sport Webb's
1441
+
characteristic pattern of diffraction spikes. Huge jets of shocked molecular
1442
+
hydrogen blasting from newborn stars are red in the image, with the large,
1443
+
yellowish dusty cavity carved out by the energetic young star near its center.
1444
+
Near some stars in the stunning image are shadows cast by their protoplanetary
Let's take a look at the first 3 most recent tweets of [@scikit_learn](https://twitter.com/scikit_learn) through accessing the attributes of tweet data dictionary:
1457
-
1458
1475
```{code-cell} ipython3
1459
-
:tags: [remove-output]
1460
-
1461
-
for info in scikit_learn_tweets[:3]:
1462
-
print("ID: {}".format(info.id))
1463
-
print(info.created_at)
1464
-
print(info.full_text)
1465
-
print("\n")
1466
-
```
1467
-
1476
+
:tags: [remove-input]
1477
+
import json
1478
+
with open("data/nasa.json", "r") as f:
1479
+
nasa_data = json.load(f)
1480
+
# the last entry in the stored data is July 13, 2023, so print that
1481
+
nasa_data[-1]
1468
1482
```
1469
-
ID: 1555686128971403265
1470
-
2022-08-05 22:44:11+00:00
1471
-
scikit-learn 1.1.2 is out on https://t.co/lSpi4eDc2t and conda-forge!
1472
-
1473
-
This is a small maintenance release that fixes a couple of regressions:
1474
-
https://t.co/Oa84ES0qpG
1475
1483
1484
+
We can obtain more records at once by using the `start_date` and `end_date` parameters.
1485
+
Let's obtain all the records between May 1, 2023, and July 13, 2023, and store the result
1486
+
in an object called `nasa_data`; now the response
1487
+
will take the form of a Python list, with one dictionary item similar to the above
1488
+
for each of the 74 days between the start and end dates:
1476
1489
1477
-
ID: 1549321048943988737
1478
-
2022-07-19 09:11:37+00:00
1479
-
RT @MarenWestermann: @scikit_learn It is worth highlighting that this scikit-learn sprint is seeing the highest participation of women out…
1480
-
1481
-
1482
-
ID: 1548339716465930244
1483
-
2022-07-16 16:12:09+00:00
1484
-
@StefanieMolin @theBodlina @RichardKlima We continue pulling requests here in Dublin. Putting some Made in Ireland code in the scikit-learn codebase 🇮🇪 . Current stats: 18 PRs opened, 12 merged 🚀 https://t.co/ccWy8vh8YI
A full list of available attributes provided by Twitter API can be found [here](https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/tweet).
1490
-
1491
-
+++
1497
+
```{code-cell} ipython3
1498
+
:tags: [remove-input]
1499
+
len(nasa_data)
1500
+
```
1492
1501
1493
-
For the demonstration purpose, let's only use a
1502
+
For further data processing using the techniques in this book, you'll need to turn this list of dictionaries
1503
+
into a `pandas` data frame.
1504
+
these items For the demonstration purpose, let's only use a
1494
1505
few variables of interest: `created_at`, `user.screen_name`, `retweeted`,
1495
1506
and `full_text`, and construct a `pandas` DataFrame using the extracted information.
0 commit comments