Make One-Row Dataframe
Notice , you should follow what cold and jpp's construction for creating the one row dataframe, but here I am try to fix your code. change DataFrame call to
pd.Series([a,b,c], index=list('abc')).to_frame(0).T
Out[15]:
a b c
0 1 2 3
pd.DataFrame([[a, b, c]], columns=['a', 'b', 'c'])
a b c
0 1 2 3
Note that your "bonus ask" isn't really possible, because an object may be associated with multiple variables (think about it).
You may, however, consider using a dictionary.
data = {'a' : 1, 'b' : 2, 'c' : 3}
pd.DataFrame(data, index=[0]) # the `index` argument is important
a b c
0 1 2 3
Single append
For a single append, there is no need to create a separate dataframe to append.
# ensure columns ordered appropriately.
df = df[['a', 'b', 'c']]
# define values
values = [1, 2, 3]
# add values to row at end of dataframe
df.loc[len(df.index)+1] = values
Multiple appends
Continually appending dataframes is extremely inefficient.
A much better idea is to append your results to a list, to form a list of a lists. Then create a dataframe from this list of lists, and append to the original. This is because appending to a list is considerably cheaper than appending to a dataframe.
Suppose you have some values in an iterable iter_values
containing data you wish to append. Each item in the iterable is a list of 3 numbers.
lst = []
# loop through iterable, adding items to list
for values in iter_values:
lst.append(values)
# create dataframe from list of lists
df_append = pd.DataFrame(lst, columns=list('abc'))
# append to original dataframe, ignoring index
df = df.append(df_append, ignore_index=True)