I've had issues finding a concise way to append a series to each row of a dataframe, with the series labels becoming new columns in the df. All the values will be the same on each of the dataframes' rows, which is desired.
I can get the effect by doing the following:
df["new_col_A"] = ser["new_col_A"]
.....
df["new_col_Z"] = ser["new_col_Z"]
But this is so tedious there must be a better way, right?
pd.concat([df, ser], axis=1)?df = pd.DataFrame([[1, 2], [1, 3], [4, 6]], columns=['A', 'B'])which when "concated" with a series like this:ser = pd.Series(["a","b"],index=["C",D"])will give a result like this:df = pd.DataFrame([[1, 2,"a","b"], [1, 3,"a","b"], [4, 6,"a","b"]], columns=['A', 'B','C','D'])