0

please I'm have a simple question but I can't see it answered anywhere. My starting point is a pandas dataframe with multiple columns. I need to select one of the columns by position and eventually convert this column to a series.

df = pd.Dataframe(no.random.randn(20,2), columns=['a','b'])
price = df.iloc[:,[1]]  # this should give us a dataframe still

I tried:

price_series = pd.Series(price) 

but it doesn't work.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Andrea
  • 113
  • 1
  • 4
  • 10

0 Answers0