Python Forum
How to split dataframe object rows to columns
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to split dataframe object rows to columns
#1
Hi,
I have below data frame (multiple rows): I want to split rows at dilimiter to columns


df_obj:
20;12;AA;2020/11/05 10:23:13;2020/11/05 10:25:13;12;LL
20;12;PT;2020/11/05 11:18:13;2020/11/05 11:23:43;34;KLY
20;12;BN;2020/11/09 11:18:13;2020/11/05 11:23:73;4;KMLY
34;2;DG;2020/11/11  11:18:13;2020/11/11 11:23:73;4;KY
I want to split each row at ";" into columns

My desiredoutpur:

df_out:
20 12 AA 2020/11/05 10:23:13 2020/11/05 10:25:13 12 LL
20 12 PT;2020/11/05 11:18:13 2020/11/05 11:23:43 34 KLY
20 12 BN 2020/11/09 11:18:13 2020/11/05 11:23:73 4 KMLY
34 2 DG 2020/11/11  11:18:13 2020/11/11 11:23:73 4 KY
I use the below line. It gives the "data frame object has no attribute split".

df_obj.split(";")
any method to split data frame object rows.
Reply


Messages In This Thread
How to split dataframe object rows to columns - by Mekala - Nov-12-2020, 02:31 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  This result object does not return rows. It has been closed automatically dawid294 6 1,057 Mar-30-2024, 03:08 AM
Last Post: NolaCuriel
  Pandas AttributeError: 'DataFrame' object has no attribute 'concat' Sameer33 5 5,664 Feb-17-2023, 06:01 PM
Last Post: Sameer33
  Converting a json file to a dataframe with rows and columns eyavuz21 13 4,488 Jan-29-2023, 03:59 PM
Last Post: eyavuz21
  How to properly format rows and columns in excel data from parsed .txt blocks jh67 7 1,881 Dec-12-2022, 08:22 PM
Last Post: jh67
  Check DataFrames with different sorting in columns and rows Foxyskippy 0 780 Nov-19-2022, 07:49 AM
Last Post: Foxyskippy
  How to assign a value to pandas dataframe column rows based on a condition klllmmm 0 843 Sep-08-2022, 06:32 AM
Last Post: klllmmm
  Nested for loops: Iterating over columns of a DataFrame to plot on subplots dm222 0 1,721 Aug-19-2022, 11:07 AM
Last Post: dm222
  AttributeError: 'numpy.int32' object has no attribute 'split' rf_kartal 6 4,416 Jun-24-2022, 08:37 AM
Last Post: Anushka00
  [split] TypeError: 'int' object is not callable flash77 4 2,764 Mar-21-2022, 09:44 PM
Last Post: deanhystad
  Split single column to multiple columns SriRajesh 1 1,336 Jan-07-2022, 06:43 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

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