0

I'm trying to get the column of a Dataframe as Series.

df['a']

returns allways a pl.Dataframe. Right now I'm doing it this way

pl.Series('GID_1',df['GID_1'].to_numpy().flatten().tolist())

I don't think that's the best way to do it. Does anyone have an idea?

seb2704
  • 390
  • 1
  • 5
  • 17

1 Answers1

3

I don't really understand. This snippet runs, so it returns a pl.Series.

df = pl.DataFrame({
    "A": [1, 2, 3],
    "B": [1, 2, 3]
})

assert isinstance(df["A"], pl.Series)
ritchie46
  • 10,405
  • 1
  • 24
  • 43
  • 1
    oh sorry, it works for me too. I don't know what i did wrong before, maybe i used double square brackets and didn't noticed it. Sorry for wasting u'r time – seb2704 Nov 10 '21 at 19:01