Python Forum

Full Version: Get values from a split column
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I split a dataframe column..

df['new_col'] = df['col'].str.split('aa', expand=False)

Now how do I get the individual list values in 'new_col'?

  1. show enough of a code snippet to run.
  2. what does df look like?
  3. does it indeed have a key of 'New_col'?
  4. show your error trace back, complete and unaltered.
(Apr-17-2020, 09:49 PM)Pythonito Wrote: [ -> ]Now how do I get the individual list values in 'new_col'?
Did you try .values attribute?, e.g.
df['new_col'].values
or
df['new_col'].values[0]
Quote:Now how do I get the individual list values in 'new_col'?
Larz60+ did not wrute this