Python Forum
Transform 3 Columns into Single Column
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Transform 3 Columns into Single Column
#7
I don't know what your column header names are.

Either call the columns col1, col2, col3 etc., or put your column header names in here, for any columns you want to single out.
# get each column 
columns = ['col1', 'col2', 'col3'] # put your column headers
That is to say, look in row 1 of your csv and see what the names of the columns you want to get are.
If there are no column headers, I believe Pandas will set something like col1, col2 ... but I don't really use Pandas for my little amounts of data.
Best set the names you want in row 1.
Reply


Messages In This Thread
Transform 3 Columns into Single Column - by DaveG - Apr-03-2022, 11:11 PM
RE: Transform 3 Columns into Single Column - by Pedroski55 - Apr-04-2022, 08:00 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Converting column of values into muliple columns of counts highland44 0 367 Feb-01-2024, 12:48 AM
Last Post: highland44
  [SOLVED] Looking for documentation on Reportlab's canvas.transform() function NeilUK 1 727 Aug-23-2023, 01:21 PM
Last Post: NeilUK
  Reshaping a single column in to multiple column using Python sahar 7 2,211 Jun-20-2022, 12:35 PM
Last Post: deanhystad
  df column aggregate and group by multiple columns SriRajesh 0 1,129 May-06-2022, 02:26 PM
Last Post: SriRajesh
  Transform Dic to dataframe d9d9d 4 1,494 Apr-14-2022, 09:35 AM
Last Post: perfringo
  Split single column to multiple columns SriRajesh 1 1,410 Jan-07-2022, 06:43 PM
Last Post: jefsummers
  How to transform from wide to long format in python shantanu97 1 1,753 Nov-21-2021, 11:53 AM
Last Post: buran
  How to remove a column or two columns in a correlation heatmap? lulu43366 3 5,490 Sep-30-2021, 03:47 PM
Last Post: lulu43366
  Index error - columns vs non-column Vinny 3 5,097 Aug-09-2021, 04:46 PM
Last Post: snippsat
  Need Help splitting a column into many columns cokicoki 0 1,458 Jun-18-2021, 12:30 PM
Last Post: cokicoki

Forum Jump:

User Panel Messages

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