'Re-aligning the data frame from one df to another df

Good Morning,

Could you please help with re-aligning the data frame from one df to another df?

Screenshot 1 : df

enter image description here

This is a raw data we receive from customers and we will need to re-process this data as below screenshot to upload the data in Tally Software

Screenshot 2 : df1 enter image description here

If the Rows are minimal it’s easy to update the data manually and with a large set of data its very difficult to update the data.

When you compare df and df1:

Issue 1: Voucher No in df1 is same as inv.No on df. However, I need a way to replicate the same Voucher No in two consecutive Rows as in screenshot 2. I am not sure how to get this?

Issue 2 : Voucher Date in df1 is same as Date in df. However, I need a way to replicate the same Voucher Date in two consecutive Rows as in screenshot 2. I am not sure how to get this?

Issue 3: In the Ledger Name in df1 after every customer I need to input sales@12% and Gst@12%, I am not sure how to get this?

Issue 4: The Credit amount is calculated as 45,390 * 12% = 5446 and 45,390 – 5446 = 39,943. I know how to calculate this using pandas but not sure how I will format and update the cells same as in the Screenshot 2 with all those blanks and data.

We wont be able to change the format of screenshot 2 as the software does not allow to upload if the format changes.

Could you please guide me? I am very new to using python and pandas libraries. I am using jupyter Lab to complete this task.

Regards Aravind Viswanathan.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source