6. World Cities Data Set¶
from datascience import *
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plots
plots.style.use('fivethirtyeight')
This data is from simplemaps.com/data/world-cities¶
Warning
Getting an error when table loads. Will repair and repost.
citie = Table.read_table('http://faculty.ung.edu/rsinn/worldcities.csv')
cities
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-2-cec6dd70bcbc> in <module>
----> 1 citie = Table.read_table('http://faculty.ung.edu/rsinn/worldcities.csv')
2 cities
~\anaconda3\envs\datasci\lib\site-packages\datascience\tables.py in read_table(cls, filepath_or_buffer, *args, **vargs)
143 except AttributeError:
144 pass
--> 145 df = pandas.read_csv(filepath_or_buffer, *args, **vargs)
146 return cls.from_df(df)
147
~\anaconda3\envs\datasci\lib\site-packages\pandas\io\parsers.py in read_csv(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, dialect, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options)
608 kwds.update(kwds_defaults)
609
--> 610 return _read(filepath_or_buffer, kwds)
611
612
~\anaconda3\envs\datasci\lib\site-packages\pandas\io\parsers.py in _read(filepath_or_buffer, kwds)
460
461 # Create the parser.
--> 462 parser = TextFileReader(filepath_or_buffer, **kwds)
463
464 if chunksize or iterator:
~\anaconda3\envs\datasci\lib\site-packages\pandas\io\parsers.py in __init__(self, f, engine, **kwds)
817 self.options["has_index_names"] = kwds["has_index_names"]
818
--> 819 self._engine = self._make_engine(self.engine)
820
821 def close(self):
~\anaconda3\envs\datasci\lib\site-packages\pandas\io\parsers.py in _make_engine(self, engine)
1048 )
1049 # error: Too many arguments for "ParserBase"
-> 1050 return mapping[engine](self.f, **self.options) # type: ignore[call-arg]
1051
1052 def _failover_to_python(self):
~\anaconda3\envs\datasci\lib\site-packages\pandas\io\parsers.py in __init__(self, src, **kwds)
1896
1897 try:
-> 1898 self._reader = parsers.TextReader(self.handles.handle, **kwds)
1899 except Exception:
1900 self.handles.close()
pandas\_libs\parsers.pyx in pandas._libs.parsers.TextReader.__cinit__()
pandas\_libs\parsers.pyx in pandas._libs.parsers.TextReader._get_header()
pandas\_libs\parsers.pyx in pandas._libs.parsers.TextReader._tokenize_rows()
pandas\_libs\parsers.pyx in pandas._libs.parsers.raise_parser_error()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf4 in position 6032: invalid continuation byte