शुरू करेंमुफ़्त में शुरू करें

Bounding box तक पहुँचना

ज्यादातर ट्वीट जिनमें coordinate-स्तर की भौगोलिक जानकारी जुड़ी होती है, वे आम तौर पर bounding box के रूप में आते हैं। Bounding boxes चार longitude/latitude coordinates का सेट होते हैं, जो उस खास क्षेत्र को दर्शाते हैं जहाँ उपयोगकर्ता स्थित हो सकता है। Twitter JSON में bounding box, place वैल्यू के अंदर होता है।

डेटासेट आपके लिए tweets_sotu नाम के DataFrame के रूप में लोड किया गया है.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Python में सोशल मीडिया डेटा का विश्लेषण

पाठ्यक्रम देखें

अभ्यास निर्देश

  • bounding box डिक्शनरी के अंदर coordinates वैल्यू को एक्सेस करके getBoundingBox() फंक्शन को पूरा करें.
  • tweets_sotu DataFrame के उपयुक्त कॉलम पर getBoundingBox() फंक्शन लागू करें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

def getBoundingBox(place):
    """ Returns the bounding box coordinates."""
    return place[____][____]

# Apply the function which gets bounding box coordinates
bounding_boxes = tweets_sotu[____].apply(getBoundingBox)

# Print out the first bounding box coordinates
print(bounding_boxes.values[0])
कोड संपादित करें और चलाएँ