Python Forum
Get values from a split column
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get values from a split column
#1
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'?
Reply
#2

  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.
Reply
#3
(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]
Reply
#4
Quote:Now how do I get the individual list values in 'new_col'?
Larz60+ did not wrute this
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Get an average of the unique values of a column with group by condition and assign it klllmmm 0 267 Feb-17-2024, 05:53 PM
Last Post: klllmmm
  Converting column of values into muliple columns of counts highland44 0 251 Feb-01-2024, 12:48 AM
Last Post: highland44
  [split] formula for validating monetary values? kakos_k9 1 753 Dec-17-2022, 09:28 PM
Last Post: woooee
  PowerBI: Using Python Regex to look for values in column MarcusR44 1 967 Oct-14-2022, 01:03 PM
Last Post: ibreeden
  How to combine multiple column values into 1? cubangt 15 2,812 Aug-11-2022, 08:25 PM
Last Post: cubangt
  Creating a numpy array from specific values of a spreadsheet column JulianZ 0 1,114 Apr-19-2022, 07:36 AM
Last Post: JulianZ
  How to split file by same values from column from imported CSV file? Paqqno 5 2,773 Mar-24-2022, 05:25 PM
Last Post: Paqqno
  Float Slider - Affecting Values in Column 'Pandas' planckepoch86 0 1,395 Jan-22-2022, 02:18 PM
Last Post: planckepoch86
  Split single column to multiple columns SriRajesh 1 1,319 Jan-07-2022, 06:43 PM
Last Post: jefsummers
  split txt file data on the first column value shantanu97 2 2,432 Dec-29-2021, 05:03 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020