Append multiple dataframes to a table


#1

Hi, How do I append multiple dataframes (pandas) to a table in MapD? I can use pymapd to load a pandas DataFrame to a table. How to append another dataframe to an already existing table? Thanks


#2

Hi @mkor

If you keep calling load_table and the df has the same structure as the table, it will keep loading the data in. Note that the load_table method has a keyword create with infer as its default. This will check to see if the table exists first, and if not, it will create it. Otherwise, the data are appended.

df = pd.DataFrame({"a": [1,2,3], "b":["d", "e", "f"]})
conn.load_table("foo", df, preserve_index=False)
conn.load_table("foo", df, preserve_index=False)
conn.load_table("foo", df, preserve_index=False)
conn.load_table("foo", df, preserve_index=False)
conn.load_table("foo", df, preserve_index=False)

Best,
Randy


#3

Works great! Thanks for your help Randy