Using Python (jupyter notebook) anaconda I have already the import csv file for this code 54.Show a number of primary and secondary cities (Province column only). The expected output is Province Туре...


Using Python (jupyter notebook) anaconda


I have already the import csv file for this code


54.Show a number of primary and secondary cities (Province column only).<br>The expected output is<br>Province<br>Туре<br>Primary<br>10<br>Secondary<br>7<br>

Extracted text: 54.Show a number of primary and secondary cities (Province column only). The expected output is Province Туре Primary 10 Secondary 7
In [119]: #Ex-54<br>province[province.Type<br>#province[province.Type<br>'Primary'][['Primary','Province']].count ()<br>'Secondary'][['Province']].count()<br>==<br>KeyError<br>Traceback (most recent call las<br>t)<br><ipython-input-119-326bffdd2cc4> in <module><br>1 #Ex-54<br>----> 2 province[province.Type<br>'Primary'][['Primary','Province']].coun<br>t()<br>3 #province[province.Type<br>'Secondary'][['Province']].count()<br>==<br>/opt/anaconda3/lib/python3.8/site-packages/pandas/core/frame.py<br>in<br>_geti<br>tem<br>(self, key)<br>2906<br>if is iterator(key):<br>= list(key)<br>self.loc._get_listlike_indexer (key, axis=1,<br>2907<br>key<br>-> 2908<br>indexer<br>raise_missing=True)[1]<br>2909<br>2910<br># take () does not accept boolean indexers<br>/opt/anaconda3/lib/python3.8/site-packages/pandas/core/indexing.py in<br>_ge<br>t_listlike_indexer(self, key, axis, raise_missing)<br>1252<br>keyarr, indexer, new_indexer<br>ax._reindex_non_unique<br>%3D<br>(keyarr)<br>1253<br>-> 1254<br>self._validate_read_indexer (keyarr, indexer, axis,<br>

Extracted text: In [119]: #Ex-54 province[province.Type #province[province.Type 'Primary'][['Primary','Province']].count () 'Secondary'][['Province']].count() == KeyError Traceback (most recent call las t) in 1 #Ex-54 ----> 2 province[province.Type 'Primary'][['Primary','Province']].coun t() 3 #province[province.Type 'Secondary'][['Province']].count() == /opt/anaconda3/lib/python3.8/site-packages/pandas/core/frame.py in _geti tem (self, key) 2906 if is iterator(key): = list(key) self.loc._get_listlike_indexer (key, axis=1, 2907 key -> 2908 indexer raise_missing=True)[1] 2909 2910 # take () does not accept boolean indexers /opt/anaconda3/lib/python3.8/site-packages/pandas/core/indexing.py in _ge t_listlike_indexer(self, key, axis, raise_missing) 1252 keyarr, indexer, new_indexer ax._reindex_non_unique %3D (keyarr) 1253 -> 1254 self._validate_read_indexer (keyarr, indexer, axis,
Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here