I have a df like the one below:
Account_num First_Name Last_Name Zipcode Amount
AAA111 AAA BBB 12345 784.23
AAA112 AAB BBA 44546 2145.32
AAA113 AAC BBC 75452 6563.24
AAA114 AAD BBD 5484 9532.21
I need to format this dataframe so that the columns are in a certain position from the beginning of the line. For example:
I need the account_num to start at char 5 instead of being at char 1 of the line. Since the account_nums are always 6 characters long, I need the first_name to start at 13th character of the line.(including a space) and so on.
I have the example in sas and want to rewrite it in Panda. How can this be done? put @5(acct_num) @13(first_name)($char32. -l)@20(last_Name) ($char32. -l)
1234567891112131415161718192021222324252627282930
AAA111 AAA BBB 12345 784.23
AAA112 AAB BBA 44546 2145.32
AAA113 AAC BBC 75452 6563.24
AAA114 AAD BBD 45484 9532.21
In the above, the first line denotes the character count and my output needs to be that the account_num column starts at char 5 and First_Name starts at 13, last_Name at 20 and so on