I want to add one row to pandas DataFrame. I figured that I can do it like this:
import pandas as pd
X = pd.DataFrame(dict(x=range(10**6-1)))
X.loc[len(X)] = 42
However when the length of my DataFrame is 10**6
or anything bigger it seems to fail:
Y = pd.DataFrame(dict(y=range(10**6)))
Y.loc[len(Y)] = 42
IndexError: index out of bounds
This seems obvious bug to me. I wonder what is so magical in this 10**6
though..
I am running pandas 16.2 on 64bit windows 7 and python 2.7.
E: I couldn't find anything on github about this so I went ahead and created an issue: https://github.com/pydata/pandas/issues/10692
Hopefully that is the right thing to do.