for i in Suburb:
values = melb_data[melb_data.Suburb == i].CouncilArea.mode()[0]
mask = melb_data[melb_data.Suburb == i]['CouncilArea'].isnull()
melb_data[melb_data.Suburb == i].CouncilArea.fillna(value = values,inplace = True)
and the error is
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_value(self, series, key)
4374 return self._engine.get_value(s, k,
-> 4375 tz=getattr(series.dtype, 'tz', None))
4376 except KeyError as e1:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item()
KeyError: 0
During handling of the above exception, another exception occurred:
IndexError Traceback (most recent call last)
<ipython-input-25-ad558584b420> in <module>
1 for i in Suburb:
----> 2 values = melb_data[melb_data.Suburb == i].CouncilArea.mode()[0]
3 mask = melb_data[melb_data.Suburb == i]['CouncilArea'].isnull()
4 melb_data[melb_data.Suburb == i].CouncilArea.fillna(value = values,inplace = True)
~\Anaconda3\lib\site-packages\pandas\core\series.py in __getitem__(self, key)
866 key = com.apply_if_callable(key, self)
867 try:
--> 868 result = self.index.get_value(self, key)
869
870 if not is_scalar(result):
~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_value(self, series, key)
4379
4380 try:
-> 4381 return libindex.get_value_box(s, key)
4382 except IndexError:
4383 raise
pandas/_libs/index.pyx in pandas._libs.index.get_value_box()
pandas/_libs/index.pyx in pandas._libs.index.get_value_at()
pandas/_libs/util.pxd in pandas._libs.util.get_value_at()
pandas/_libs/util.pxd in pandas._libs.util.validate_indexer()
IndexError: index out of bounds