You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import pandas as pd
import geopandas as gpd
hkg=gpd.read_file('hkg.geojson')
pop= pd.read_csv('Population.csv')
hkg.columns=['地區號碼','Distric','地區','Administrative District Boundary of Hong Kong','geometry']
pop.columns=['District','Chinese','Population','Area','Density']
hkg2=pop.merge(hkg,left_on='District',right_on='Distric')
hkg2.sort_values(by='Population',ascending=False)
%matplotlib inline
import matplotlib as plt
hkg2.plot(column='Population',figsize=(20,20), cmap='YlOrRd',scheme='quantiles')
why would i fail when i try to
change form
(merging hkg(left ) and pop(right) )
to
(merging pop(left ) and hkg(right) )
~/anaconda3/lib/python3.6/site-packages/matplotlib/init.py in inner(ax, *args, **kwargs)
1715 warnings.warn(msg % (label_namer, func.name),
1716 RuntimeWarning, stacklevel=2)
-> 1717 return func(ax, *args, **kwargs)
1718 pre_doc = inner.doc
1719 if pre_doc is None:
~/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_axes.py in plot(self, *args, **kwargs)
1370 kwargs = cbook.normalize_kwargs(kwargs, _alias_map)
1371
-> 1372 for line in self._get_lines(*args, **kwargs):
1373 self.add_line(line)
1374 lines.append(line)
~/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_base.py in _grab_next_args(self, *args, **kwargs)
402 this += args[0],
403 args = args[1:]
--> 404 for seg in self._plot_args(this, kwargs):
405 yield seg
406
~/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_base.py in _plot_args(self, tup, kwargs)
392 ncx, ncy = x.shape[1], y.shape[1]
393 for j in xrange(max(ncx, ncy)):
--> 394 seg = func(x[:, j % ncx], y[:, j % ncy], kw, kwargs)
395 ret.append(seg)
396 return ret
~/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_base.py in _makeline(self, x, y, kw, kwargs)
299 default_dict = self._getdefaults(None, kw)
300 self._setdefaults(default_dict, kw)
--> 301 seg = mlines.Line2D(x, y, **kw)
302 return seg
303
~/anaconda3/lib/python3.6/site-packages/matplotlib/lines.py in init(self, xdata, ydata, linewidth, linestyle, color, marker, markersize, markeredgewidth, markeredgecolor, markerfacecolor, markerfacecoloralt, fillstyle, antialiased, dash_capstyle, solid_capstyle, dash_joinstyle, solid_joinstyle, pickradius, drawstyle, markevery, **kwargs)
424 # update kwargs before updating data to give the caller a
425 # chance to init axes (and hence unit support)
--> 426 self.update(kwargs)
427 self.pickradius = pickradius
428 self.ind_offset = 0
~/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py in update(self, props)
900 try:
901 ret = [_update_property(self, k, v)
--> 902 for k, v in props.items()]
903 finally:
904 self.eventson = store
~/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py in (.0)
900 try:
901 ret = [_update_property(self, k, v)
--> 902 for k, v in props.items()]
903 finally:
904 self.eventson = store
~/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py in update_property(self, k, v)
893 func = getattr(self, 'set' + k, None)
894 if not callable(func):
--> 895 raise AttributeError('Unknown property %s' % k)
896 return func(v)
897
AttributeError: Unknown property column
The text was updated successfully, but these errors were encountered:
KFCMike
changed the title
form an attendant of SITAHK and HKPUG
form an attendant of SITAHK and HKPUG workshops
May 20, 2018
KFCMike
changed the title
form an attendant of SITAHK and HKPUG workshops
form an attendant of SITAHK and HKPUG workshops cityu
May 20, 2018
KFCMike
changed the title
form an attendant of SITAHK and HKPUG workshops cityu
form an attendant of SITAHK and HKPUG workshops cityu(Data Visualisation.ipynb)
May 20, 2018
import pandas as pd
import geopandas as gpd
hkg=gpd.read_file('hkg.geojson')
pop= pd.read_csv('Population.csv')
hkg.columns=['地區號碼','Distric','地區','Administrative District Boundary of Hong Kong','geometry']
pop.columns=['District','Chinese','Population','Area','Density']
hkg2=pop.merge(hkg,left_on='District',right_on='Distric')
hkg2.sort_values(by='Population',ascending=False)
%matplotlib inline
import matplotlib as plt
hkg2.plot(column='Population',figsize=(20,20), cmap='YlOrRd',scheme='quantiles')
why would i fail when i try to
change form
(merging hkg(left ) and pop(right) )
to
(merging pop(left ) and hkg(right) )
The following is the error message:
AttributeError Traceback (most recent call last)
in ()
----> 1 hkg2.plot(column='geometry',figsize=(20,20), cmap='YlOrRd',scheme='quantiles')
~/anaconda3/lib/python3.6/site-packages/pandas/plotting/_core.py in call(self, x, y, kind, ax, subplots, sharex, sharey, layout, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, secondary_y, sort_columns, **kwds)
2675 fontsize=fontsize, colormap=colormap, table=table,
2676 yerr=yerr, xerr=xerr, secondary_y=secondary_y,
-> 2677 sort_columns=sort_columns, **kwds)
2678 call.doc = plot_frame.doc
2679
~/anaconda3/lib/python3.6/site-packages/pandas/plotting/_core.py in plot_frame(data, x, y, kind, ax, subplots, sharex, sharey, layout, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, secondary_y, sort_columns, **kwds)
1900 yerr=yerr, xerr=xerr,
1901 secondary_y=secondary_y, sort_columns=sort_columns,
-> 1902 **kwds)
1903
1904
~/anaconda3/lib/python3.6/site-packages/pandas/plotting/_core.py in _plot(data, x, y, subplots, ax, kind, **kwds)
1727 plot_obj = klass(data, subplots=subplots, ax=ax, kind=kind, **kwds)
1728
-> 1729 plot_obj.generate()
1730 plot_obj.draw()
1731 return plot_obj.result
~/anaconda3/lib/python3.6/site-packages/pandas/plotting/_core.py in generate(self)
250 self._compute_plot_data()
251 self._setup_subplots()
--> 252 self._make_plot()
253 self._add_table()
254 self._make_legend()
~/anaconda3/lib/python3.6/site-packages/pandas/plotting/_core.py in _make_plot(self)
975 stacking_id=stacking_id,
976 is_errorbar=is_errorbar,
--> 977 **kwds)
978 self._add_legend_handle(newlines[0], label, index=i)
979
~/anaconda3/lib/python3.6/site-packages/pandas/plotting/_core.py in _plot(cls, ax, x, y, style, column_num, stacking_id, **kwds)
991 cls._initialize_stacker(ax, stacking_id, len(y))
992 y_values = cls._get_stacked_values(ax, stacking_id, y, kwds['label'])
--> 993 lines = MPLPlot._plot(ax, x, y_values, style=style, **kwds)
994 cls._update_stacker(ax, stacking_id, y)
995 return lines
~/anaconda3/lib/python3.6/site-packages/pandas/plotting/_core.py in _plot(cls, ax, x, y, style, is_errorbar, **kwds)
605 else:
606 args = (x, y)
--> 607 return ax.plot(*args, **kwds)
608
609 def _get_index_name(self):
~/anaconda3/lib/python3.6/site-packages/matplotlib/init.py in inner(ax, *args, **kwargs)
1715 warnings.warn(msg % (label_namer, func.name),
1716 RuntimeWarning, stacklevel=2)
-> 1717 return func(ax, *args, **kwargs)
1718 pre_doc = inner.doc
1719 if pre_doc is None:
~/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_axes.py in plot(self, *args, **kwargs)
1370 kwargs = cbook.normalize_kwargs(kwargs, _alias_map)
1371
-> 1372 for line in self._get_lines(*args, **kwargs):
1373 self.add_line(line)
1374 lines.append(line)
~/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_base.py in _grab_next_args(self, *args, **kwargs)
402 this += args[0],
403 args = args[1:]
--> 404 for seg in self._plot_args(this, kwargs):
405 yield seg
406
~/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_base.py in _plot_args(self, tup, kwargs)
392 ncx, ncy = x.shape[1], y.shape[1]
393 for j in xrange(max(ncx, ncy)):
--> 394 seg = func(x[:, j % ncx], y[:, j % ncy], kw, kwargs)
395 ret.append(seg)
396 return ret
~/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_base.py in _makeline(self, x, y, kw, kwargs)
299 default_dict = self._getdefaults(None, kw)
300 self._setdefaults(default_dict, kw)
--> 301 seg = mlines.Line2D(x, y, **kw)
302 return seg
303
~/anaconda3/lib/python3.6/site-packages/matplotlib/lines.py in init(self, xdata, ydata, linewidth, linestyle, color, marker, markersize, markeredgewidth, markeredgecolor, markerfacecolor, markerfacecoloralt, fillstyle, antialiased, dash_capstyle, solid_capstyle, dash_joinstyle, solid_joinstyle, pickradius, drawstyle, markevery, **kwargs)
424 # update kwargs before updating data to give the caller a
425 # chance to init axes (and hence unit support)
--> 426 self.update(kwargs)
427 self.pickradius = pickradius
428 self.ind_offset = 0
~/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py in update(self, props)
900 try:
901 ret = [_update_property(self, k, v)
--> 902 for k, v in props.items()]
903 finally:
904 self.eventson = store
~/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py in (.0)
900 try:
901 ret = [_update_property(self, k, v)
--> 902 for k, v in props.items()]
903 finally:
904 self.eventson = store
~/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py in update_property(self, k, v)
893 func = getattr(self, 'set' + k, None)
894 if not callable(func):
--> 895 raise AttributeError('Unknown property %s' % k)
896 return func(v)
897
AttributeError: Unknown property column
The text was updated successfully, but these errors were encountered: