Plotting data 20180201-2223




Pay Notebook Creator: Karsh Patel0
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0
Total0
In [1]:
import pandas as pd
In [2]:
d=pd.read_csv("Air_Quality.csv")
In [3]:
d
Out[3]:
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; } </style>
indicator_data_id indicator_id name Measure geo_type_name geo_entity_id geo_entity_name year_description data_valuemessage
0 130728 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration Borough 1 Bronx 2005 2.8
1 130729 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration Borough 2 Brooklyn 2005 2.8
2 130730 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration Borough 3 Manhattan 2005 4.7
3 130731 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration Borough 4 Queens 2005 1.9
4 130732 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration Borough 5 Staten Island 2005 1.6
5 130727 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration Citywide 1 New York City 2005 2.9
6 130685 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 101 Kingsbridge - Riverdale 2005 2.9
7 130686 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 102 Northeast Bronx 2005 2.8
8 130687 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 103 Fordham - Bronx Pk 2005 2.7
9 130688 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 104 Pelham - Throgs Neck 2005 2.7
10 130689 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 105 Crotona -Tremont 2005 3
11 130690 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 106 High Bridge - Morrisania 2005 3
12 130691 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 107 Hunts Point - Mott Haven 2005 2.8
13 130692 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 201 Greenpoint 2005 3.7
14 130693 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 202 Downtown - Heights - Slope 2005 3.7
15 130694 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 203 Bedford Stuyvesant - Crown Heights 2005 2.5
16 130695 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 204 East New York 2005 2.3
17 130696 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 205 Sunset Park 2005 3.2
18 130697 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 206 Borough Park 2005 2.5
19 130698 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 207 East Flatbush - Flatbush 2005 2.3
20 130699 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 208 Canarsie - Flatlands 2005 2.4
21 130700 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 209 Bensonhurst - Bay Ridge 2005 2.8
22 130701 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 210 Coney Island - Sheepshead Bay 2005 2.4
23 130702 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 211 Williamsburg - Bushwick 2005 2.8
24 130703 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 301 Washington Heights 2005 4.1
25 130704 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 302 Central Harlem - Morningside Heights 2005 3.9
26 130705 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 303 East Harlem 2005 4.2
27 130706 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 304 Upper West Side 2005 3.9
28 130707 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 305 Upper East Side 2005 4.5
29 130708 646 Air Toxics Concentrations- Average Benzene Con... Average Concentration UHF42 306 Chelsea - Clinton 2005 4.9
... ... ... ... ... ... ... ... ... ...
2739 151731 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 206 Borough Park 2005 1.1
2740 151732 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 207 East Flatbush - Flatbush 2005 0.9
2741 151733 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 208 Canarsie - Flatlands 2005 0.4
2742 151734 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 209 Bensonhurst - Bay Ridge 2005 1
2743 151735 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 210 Coney Island - Sheepshead Bay 2005 0.6
2744 151736 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 211 Williamsburg - Bushwick 2005 0.5
2745 151737 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 301 Washington Heights 2005 1.6
2746 151738 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 302 Central Harlem - Morningside Heights 2005 0.9
2747 151739 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 303 East Harlem 2005 2.1
2748 151740 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 304 Upper West Side 2005 1.9
2749 151741 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 305 Upper East Side 2005 2.9
2750 151742 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 306 Chelsea - Clinton 2005 3.4
2751 151743 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 307 Gramercy Park - Murray Hill 2005 4.4
2752 151744 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 308 Greenwich Village - SoHo 2005 3.8
2753 151745 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 309 Union Square - Lower East Side 2005 3.2
2754 151746 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 310 Lower Manhattan 2005 1.6
2755 151747 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 401 Long Island City - Astoria 2005 1.2
2756 151748 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 402 West Queens 2005 2
2757 151749 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 403 Flushing - Clearview 2005 1.2
2758 151750 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 404 Bayside - Little Neck 2005 2
2759 151751 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 405 Ridgewood - Forest Hills 2005 1
2760 151752 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 406 Fresh Meadows 2005 2.1
2761 151753 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 407 Southwest Queens 2005 1.4
2762 151754 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 408 Jamaica 2005 0.6
2763 151755 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 409 Southeast Queens 2005 0.5
2764 151756 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 410 Rockaways 2005 0.2
2765 151757 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 501 Port Richmond 2005 0.3
2766 151758 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 502 Stapleton - St. George 2005 0.8
2767 151759 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 503 Willowbrook 2005 0.8
2768 151760 645 Traffic Density- Annual Vehicle Miles Traveled... Per 100 km2 UHF42 504 South Beach - Tottenville 2005 0.3
<p>2769 rows × 9 columns</p>
In [6]:
d["year_description"].unique()
Out[6]:
array(['2005', '2013', 'Annual Average 2009-2010',
       '2-Year Winter Average 2009-2010', '2005-2007', '2009-2011',
       ' Tribeca', ' SOHO', ' Chinatown', ' Clinton', ' Turtle Bay',
       ' Upper West Side', ' Hamilton Heights', ' Inwood', ' Mott Haven',
       ' Longwood', ' Crotona Park East', ' Concourse Village',
       ' Fordham', ' Belmont', ' Norwood', ' Kingsbridge', ' Parkchester',
       'Co-op City', ' Morris Park', ' Williamsbridge', ' Greenpoint',
       ' Fort Greene', ' Starrett City', ' Carroll Gardens',
       ' Windsor Terrace', ' Wingate', ' Dyker Heights', ' Bath Beach',
       ' Ocean Parkway', ' Brighton Beach', ' Midwood',
       ' Gerritsen Beach', ' Ocean Hill', ' Rugby', ' Flatlands',
       ' Long Island City', ' Woodside', ' North Corona', ' South Corona',
       ' Glendale', ' Rego Park', ' Briarwood', ' Richmond Hill',
       ' Howard Beach', ' Douglastown', ' St. Albans', ' Rosedale',
       ' Broad Channel', ' Port Richmond', ' South Beach', ' Woodrow'],
      dtype=object)
In [7]:
d.columns
Out[7]:
Index(['indicator_data_id', 'indicator_id', 'name', 'Measure', 'geo_type_name',
       'geo_entity_id', 'geo_entity_name', 'year_description',
       'data_valuemessage'],
      dtype='object')
In [ ]:
 
In [9]:
pd.read_csv('https://data.cityofnewyork.us/api/views/c3uy-2p5r/files/qrGQpP1FBXsB0X85PF3ExYfdax964Xv64OdhTYHJAw4?download=true&filename=OutdoorAirandHealthInfoSource.csv')
---------------------------------------------------------------------------
UnicodeDecodeError                        Traceback (most recent call last)
pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._convert_tokens()

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._convert_with_dtype()

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._string_convert()

pandas/_libs/parsers.pyx in pandas._libs.parsers._string_box_utf8()

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 81: invalid start byte

During handling of the above exception, another exception occurred:

UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-9-379f5cc4cb0a> in <module>()
----> 1 pd.read_csv('https://data.cityofnewyork.us/api/views/c3uy-2p5r/files/qrGQpP1FBXsB0X85PF3ExYfdax964Xv64OdhTYHJAw4?download=true&filename=OutdoorAirandHealthInfoSource.csv')

~/.virtualenvs/crosscompute/lib/python3.6/site-packages/pandas/io/parsers.py in parser_f(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, escapechar, comment, encoding, dialect, tupleize_cols, error_bad_lines, warn_bad_lines, skipfooter, skip_footer, doublequote, delim_whitespace, as_recarray, compact_ints, use_unsigned, low_memory, buffer_lines, memory_map, float_precision)
    707                     skip_blank_lines=skip_blank_lines)
    708 
--> 709         return _read(filepath_or_buffer, kwds)
    710 
    711     parser_f.__name__ = name

~/.virtualenvs/crosscompute/lib/python3.6/site-packages/pandas/io/parsers.py in _read(filepath_or_buffer, kwds)
    453 
    454     try:
--> 455         data = parser.read(nrows)
    456     finally:
    457         parser.close()

~/.virtualenvs/crosscompute/lib/python3.6/site-packages/pandas/io/parsers.py in read(self, nrows)
   1067                 raise ValueError('skipfooter not supported for iteration')
   1068 
-> 1069         ret = self._engine.read(nrows)
   1070 
   1071         if self.options.get('as_recarray'):

~/.virtualenvs/crosscompute/lib/python3.6/site-packages/pandas/io/parsers.py in read(self, nrows)
   1837     def read(self, nrows=None):
   1838         try:
-> 1839             data = self._reader.read(nrows)
   1840         except StopIteration:
   1841             if self._first_chunk:

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.read()

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._read_low_memory()

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._read_rows()

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._convert_column_data()

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._convert_tokens()

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._convert_with_dtype()

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._string_convert()

pandas/_libs/parsers.pyx in pandas._libs.parsers._string_box_utf8()

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 81: invalid start byte
In [ ]: