What I have below is an example of the type of the type of concatenation that I am trying to do.
df = pd.DataFrame(np.array([1, 2, 3]).reshape((1, 3)), columns = ['col1', 'col2', 'col3'], index = ['a']) df2 = pd.DataFrame() # already exists elsewhere in code df2 = df2.append([df, pd.Series(1, name = 'label')]) The result I am hoping for is:
col1 col2 col3 label a 1.0 2.0 3.0 1 but I get is
col1 col2 col3 0 a 1.0 2.0 3.0 NaN 0 NaN NaN NaN 1.0 I know that I'm joining these wrong, but I cannot seem to figure out how its done. Any advice?