from datascience import *
import numpy as np
Table.interactive_plots()
import plotly.express as px
sky = Table.read_table('data/skyscrapers.csv') \
.where('status.current', are.contained_in(['completed', 'under construction'])) \
.select('name', 'location.city', 'location.latitude', 'location.longitude',
'statistics.floors above', 'statistics.height', 'status.completed.year') \
.relabeled(['location.city', 'location.latitude', 'location.longitude',
'statistics.floors above', 'statistics.height', 'status.completed.year'],
['city', 'latitude', 'longitude', 'floors', 'height', 'year']) \
.where('height', are.above(0)) \
.where('floors', are.above(0))
sky
name | city | latitude | longitude | floors | height | year |
---|---|---|---|---|---|---|
One World Trade Center | New York City | 40.7131 | -74.0134 | 94 | 541.3 | 2014 |
Central Park Tower | New York City | 40.7664 | -73.9809 | 95 | 541.02 | 2019 |
Willis Tower | Chicago | 41.8789 | -87.6359 | 108 | 442.14 | 1974 |
111 West 57th Street | New York City | 40.7648 | -73.9775 | 80 | 438.3 | 2018 |
432 Park Avenue | New York City | 40.7616 | -73.9719 | 85 | 425.5 | 2015 |
Trump International Hotel & Tower | Chicago | 41.8889 | -87.6264 | 98 | 423.22 | 2009 |
30 Hudson Yards | New York City | 40.754 | -74.0008 | 73 | 386.61 | 2019 |
Empire State Building | New York City | 40.7484 | -73.9856 | 102 | 381 | 1931 |
Bank of America Tower | New York City | 40.7554 | -73.9844 | 55 | 365.8 | 2009 |
Aon Center | Chicago | 41.8852 | -87.6215 | 83 | 346.26 | 1973 |
... (2145 rows omitted)
sky.group('city') \
.where('count', are.above_or_equal_to(40)) \
.sort('count', descending = True) \
.barh('city', title = 'Number of Skyscrapers Per City')