DataFrame constructor

Hi everyone,
I have a question regarding dataframe constructors. I have these two series:

price_series = pd.Series(car_dic_mean_price)
milage_series = pd.Series(car_dic_mean_milage)

I am trying to make a dataframe using two series. I have successfully done it by doing it:

df = pd.DataFrame(price_series, columns = ["mean_price")]

My question is it possible to add two series at the same time? Like this.

df = pd.DataFrame(price_series, milage_series, \
                  columns = ["mean_price", "mean_milage"])

I am getting this error message:

ValueError: Shape of passed values is (1, 10), indices imply (2, 10)

This is from part 8 of 3rd Guided project: Exploring Ebay Car Sales Data. Thanks for any help on this

1 Like

Try the following

df = pd.DataFrame({'mean_price': price_series, 'mean_milage': milage_series})
2 Likes

Got it. Just pass it as a dictionary. Thanks

1 Like