import pandas as pd
#create prices Series Object:
prices_ds = pd.Series([1.5, 2, 2.5, 3],
index=["apples", "oranges", "bananas", "strawberies"])
prices_ds
# create DataFrame Object from prices Series:
prices_df = pd.DataFrame(prices_ds, columns=["prices"])
prices_df
# the Series objects:
prices_ds = pd.Series([1.5, 2, 2.5, 3],
index=["apples", "oranges", "bananas", "strawberries"])
suppliers_ds = pd.Series(["supplier1", "supplier2", "supplier4", "supplier3"],
index=["apples", "oranges", "bananas", "strawberries"])
# the DataFrame object:
fruits_df = pd.DataFrame({
"prices": prices_ds,
"suppliers": suppliers_ds
})
print(fruits_df)