ComenzarEmpieza gratis

Accessing bounding box

Most tweets which have coordinate-level geographical information attached to them typically come in the form of a bounding box. Bounding boxes are a set of four longitudinal/latitudinal coordinates which denote a particular area in which the user can be located. The bounding box is located in the place value of the Twitter JSON.

The dataset has been loaded for you as a DataFrame in tweets_sotu.

Este ejercicio forma parte del curso

Analyzing Social Media Data in Python

Ver curso

Instrucciones del ejercicio

  • Complete the getBoundingBox() function by accessing the coordinates value within the bounding box dictionary.
  • Apply the getBoundingBox() function to the appropriate column in the tweets_sotu DataFrame.

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

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])
Editar y ejecutar código