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
#2
You can convert your data in to a string first, then split it or iterate over it. You basically just want to change the ";"s to spaces.
old_data_string = str(df_obj)
new_data_string = ""

for character in old_data_string:
    if character == ";":
        new_data_string.append(" ")
    else:
        new_data_string.append(character)
Full disclosure, I don't know if the "/"s in your data will screw up anything, and this not the most pythony solution, but it might get you started.
Reply


Messages In This Thread
RE: How to split dataframe object rows to columns - by michael1789 - Nov-12-2020, 04:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  This result object does not return rows. It has been closed automatically dawid294 5 681 Jan-10-2024, 10:55 PM
Last Post: deanhystad
  Pandas AttributeError: 'DataFrame' object has no attribute 'concat' Sameer33 5 5,300 Feb-17-2023, 06:01 PM
Last Post: Sameer33
  Converting a json file to a dataframe with rows and columns eyavuz21 13 4,169 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,802 Dec-12-2022, 08:22 PM
Last Post: jh67
  Check DataFrames with different sorting in columns and rows Foxyskippy 0 752 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 798 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,639 Aug-19-2022, 11:07 AM
Last Post: dm222
  AttributeError: 'numpy.int32' object has no attribute 'split' rf_kartal 6 4,196 Jun-24-2022, 08:37 AM
Last Post: Anushka00
  [split] TypeError: 'int' object is not callable flash77 4 2,677 Mar-21-2022, 09:44 PM
Last Post: deanhystad
  Split single column to multiple columns SriRajesh 1 1,290 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