pandas Adding a new row to DataFrame


Example

Given a DataFrame:

s1 = pd.Series([1,2,3])
s2 = pd.Series(['a','b','c'])

df = pd.DataFrame([list(s1), list(s2)],  columns =  ["C1", "C2", "C3"])
print df

Output:

  C1 C2 C3
0  1  2  3
1  a  b  c

Lets add a new row, [10,11,12]:

df = pd.DataFrame(np.array([[10,11,12]]), \
        columns=["C1", "C2", "C3"]).append(df, ignore_index=True)
print df

Output:

   C1  C2  C3
0  10  11  12
1   1   2   3
2   a   b   c