Python Forum
Split single column to multiple columns
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Split single column to multiple columns
#1
Hi,
I have pandas.core.Dataframe as below
When I write to csv using df.to_csv it placed in single columns and 8 rows with delimiter as comma(","). First row is A,B,C,D. I want to separate 4by1 to 4by4.
when I type df.columns it give Index([A,B,C,D]).

A,B,C,D
1,2,3,4
5,6,7,8,
9,1,3
Reply
#2
Need to see your code defining and filling the dataframe to see why it is doing this.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Exploding multiple columns Mormolyce 2 2,684 Sep-07-2025, 02:13 PM
Last Post: Mormolyce
  Transform 3 Columns into Single Column DaveG 9 4,903 Mar-19-2025, 03:46 AM
Last Post: robbert23
  Converting column of values into muliple columns of counts highland44 0 1,299 Feb-01-2024, 12:48 AM
Last Post: highland44
  How to check multiple columns value within range SamLiu 2 3,115 Mar-13-2023, 09:32 AM
Last Post: SamLiu
  Create multiple/single csv file for each sql records mg24 6 3,796 Sep-29-2022, 08:06 AM
Last Post: buran
  How to split the input taken from user into a single character? mHosseinDS86 3 3,345 Aug-17-2022, 12:43 PM
Last Post: Pedroski55
  How to combine multiple column values into 1? cubangt 15 9,695 Aug-11-2022, 08:25 PM
Last Post: cubangt
  How to move multiple columns to initial position SriRajesh 4 4,025 Jul-02-2022, 10:34 AM
Last Post: deanhystad
  Reshaping a single column in to multiple column using Python sahar 7 4,683 Jun-20-2022, 12:35 PM
Last Post: deanhystad
  df column aggregate and group by multiple columns SriRajesh 0 2,167 May-06-2022, 02:26 PM
Last Post: SriRajesh

Forum Jump:

User Panel Messages

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