Python Forum
add the suffix to the next line
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
add the suffix to the next line
#1
Hi,

Does anybody know the shortest command to add a suffix to the header of several columns below the header and not on the same line?

I have the dataframe below:

   Type     Price1     Price2     Price3      Price4      Price5      
0    A       5.467     17.450     14.340     233.440     143.550
1    B      12.347     33.776     19.700     443.335     119.450
and if I use add_suffix(' USD'), it adds the USD on the same line:

   Type     Price1 USD     Price2 USD     Price3 USD      Price4 USD      Price5 USD      
0    A           5.467         17.450         14.340         233.440         143.550
1    B          12.347         33.776         19.700         443.335         119.450
While I want the USD in the line below of the prices:

   Type     Price1     Price2     Price3      Price4      Price5      
               USD        USD        USD         USD         USD
0    A       5.467     17.450     14.340     233.440     143.550
1    B      12.347     33.776     19.700     443.335     119.450
Reply
#2
Wouldadd_suffix('\n USD'do what you want?
Reply
#3
Thanks, already tried and it would have been too nice if it worked Cry .... the \n when used in the add_ suffix or add_prefix is treated like a text within the ' ' and not as a command like in print().

After digging a lot in the Internet I think that this matter is much more complicated than an easy command to add somewhere in the code!!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  String add prefix & suffix nahom 3 3,162 Sep-30-2019, 11:09 PM
Last Post: Gribouillis
  number plus suffix Skaperen 5 3,406 Jun-05-2019, 07:10 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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