Reputation: 540
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?
Upvotes: 5
Views: 4134
Reputation: 14710
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)
Upvotes: 8