Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pandas Shift Column
#1
Hi guys,

I'm new to Pandas and after 2 days of desperate trying I would like to ask for your help.

I have an output by a program in a txt file with a variable number of colums which I loaded into a Data frame.
Unfortunately it looks like this and I need to change the layout using Pandas:
[Image: 32031061wr.jpg]

I would like to shift all colums, which contain a non numeric value in row 0 + delete the first row afterwards + delete all columns containing ***

The result should look like this
[Image: 32031062ts.png]

I suppose I need to use the functions .isnumeric() or some kind of regex contains."[a-zA-Z]" to identify the columns that need to be shifted.

Thank you for your help!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  HTML Decoder pandas dataframe column mbrown009 3 1,027 Sep-29-2023, 05:56 PM
Last Post: deanhystad
  pandas column percentile nuncio 7 2,443 Aug-10-2022, 04:41 AM
Last Post: nuncio
  pandas: Compute the % of the unique values in a column JaneTan 1 1,778 Oct-25-2021, 07:55 PM
Last Post: jefsummers
  Pandas Data frame column condition check based on length of the value aditi06 1 2,692 Jul-28-2021, 11:08 AM
Last Post: jefsummers
  How to move each team row to a new column. Pandas vladiwnl 0 1,718 Jun-13-2021, 08:10 AM
Last Post: vladiwnl
  iretate over columns in df and calculate euclidean distance with one column in pandas Pit292 0 3,301 May-09-2021, 06:46 PM
Last Post: Pit292
Question Pandas - Creating additional column in dataframe from another column Azureaus 2 2,963 Jan-11-2021, 09:53 PM
Last Post: Azureaus
  Combine groupby() and shift() in pandas rama27 0 4,205 Nov-17-2020, 09:49 PM
Last Post: rama27
  Pandas: summing columns conditional on the column labels ddd2332 0 2,111 Sep-10-2020, 05:58 PM
Last Post: ddd2332
  How to shift data frame rows of specified column Mekala 0 1,901 Jul-21-2020, 02:42 PM
Last Post: Mekala

Forum Jump:

User Panel Messages

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