Here is my code:
import pandas as pd
df = pd.DataFrame(columns = ["A", "B"])
df.iloc[0]['A'] = 5
Here is output:
Traceback (most recent call last):
File "K:/Dop/Pentas/Simpletest/Temp.py", line 38, in <module>
df.iloc[0]['A'] = 5
File "C:\Python34\lib\site-packages\pandas\core\indexing.py", line 1189, in __getitem__
return self._getitem_axis(key, axis=0)
File "C:\Python34\lib\site-packages\pandas\core\indexing.py", line 1480, in _getitem_axis
return self._get_loc(key, axis=axis)
File "C:\Python34\lib\site-packages\pandas\core\indexing.py", line 89, in _get_loc
return self.obj._ixs(key, axis=axis)
File "C:\Python34\lib\site-packages\pandas\core\frame.py", line 1719, in _ixs
label = self.index[i]
File "C:\Python34\lib\site-packages\pandas\core\index.py", line 1076, in __getitem__
return getitem(key)
IndexError: index 0 is out of bounds for axis 0 with size 0
Any suggestions on how to fix it? I do not know overall size of my dataframe before hand, but I can guess.