Python Forum
Multi-Indexing in Single Column
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multi-Indexing in Single Column
#1
Hello,

I'm trying to create a more visually appealing dataframe and so I want my index to be broken down into categories with different headings.I tried various ways to do this with no luck. Multi-Indexing seems like my best chance but I don't want it in two column as my desire is to have simple headings or titles within the index.

Is this possible?

Thank you
Reply
#2
Not sure I understand, but I would suggest using .map to get multiple columns with values - commonly used for "one hot" encoding.
Reply
#3
(Oct-16-2020, 05:32 PM)jefsummers Wrote: Not sure I understand, but I would suggest using .map to get multiple columns with values - commonly used for "one hot" encoding.

Don't think this will do the trick.

Currently I have a dataframe with a dozen or so index items as such:
Output:
Q2-2020 Total Equity 4827.6 Loan Book 21192.5 Total Deposits 23312.4 Total Interest Income 1178.2 Net Interest Income 770.4 Credit Loss Allowance (264.5) Net Interest After Credit Loss Allowance 505.9 Fee and Commission Income 342.3 Revenue from Non-Core Business 21.9 Insurance Premiums 80 Operating Income 708.2 Staff and Administrative Expenses (341.6) EBIT 366.6 Attributable Net Income 287.2 Capex (64.1) Gross Interest Margin 0.429384 Return on Equity 0.0594913 Return on Assets 0.00886874
I want to organize the index into groups that will each have a heading.
I want something like this:

Output:
Q2-2020 Balance Sheet ASSETS Cash and cash equivalents 2567.4 Mandatory cash balances with central banks 246.8 Due from banks 1481.3 Loans and advances to customers 21192.5 Securities 3961 Financial instruments pledged under repurchase ... 884 Derivative financial assets 278.7 Deferred tax asset 20.9 Premises, equipment and right-of-use assets 708.5 Assets of the disposal groups and non-current a... 31.2 Other assets 1011.1 TOTAL ASSETS 32383.4 LIABILITIES Due to banks 712.1 Due to individuals 15108.2 Due to corporate customers 8204.2 Debt securities in issue 809.1
Where ASSETS and LIABILITIES are in the index but have no data, they are just the headings of index components.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Dividing a single column of dataframe into multiple columns based on char length darpInd 2 2,418 Mar-14-2020, 09:19 AM
Last Post: scidam
  NumPy array; selecting the a single column econmajor 0 3,033 Oct-24-2017, 04:25 PM
Last Post: econmajor

Forum Jump:

User Panel Messages

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