Python Forum
Dividing a single column of dataframe into multiple columns based on char length
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dividing a single column of dataframe into multiple columns based on char length
#3
There is Series.str.extract method in Pandas which can
split data into columns. In your case it could be applied as follows:

dftemp.iloc[:,0].str.extract(r'([a-zA-Z\s]+)(\d+)(\d+)')
Reply


Messages In This Thread
RE: Dividing a single column of dataframe into multiple columns based on char length - by scidam - Mar-14-2020, 09:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Merging rows and adding columns based on matching index pythonnewbie78 3 753 Dec-24-2023, 11:51 AM
Last Post: Pedroski55
  How to add columns to polars dataframe sayyedkamran 1 1,689 Nov-03-2023, 03:01 PM
Last Post: gulshan212
  concat 3 columns of dataframe to one column flash77 2 778 Oct-03-2023, 09:29 PM
Last Post: flash77
  HTML Decoder pandas dataframe column mbrown009 3 962 Sep-29-2023, 05:56 PM
Last Post: deanhystad
  attempt to split values from within a dataframe column mbrown009 8 2,224 Apr-10-2023, 02:06 AM
Last Post: mbrown009
  Make unique id in vectorized way based on text data column with similarity scoring ill8 0 862 Dec-12-2022, 03:22 AM
Last Post: ill8
  Creating a Dataframe from Zenodo zip file with multiple CSVs about Spotify man0s 0 1,326 Apr-26-2022, 01:45 PM
Last Post: man0s
  Pandas Dataframe Filtering based on rows mvdlm 0 1,397 Apr-02-2022, 06:39 PM
Last Post: mvdlm
  New Dataframe Column Based on Several Conditions nb1214 1 1,783 Nov-16-2021, 10:52 PM
Last Post: jefsummers
  Putting column name to dataframe, can't work. jonah88888 1 1,804 Sep-28-2021, 07:45 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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