Yes it is in DataframeâŚ
Basically it the ledger entries dataset and after doing some brainstorming i managed to get debit and credit entries in one row with that one problem arise and im not able to resolve thatâŚ
The problem is that in debit column duplicate value are coming and its because of credit column value is are more than debit columnâŚ
By Arvin via Discussions on Python.org at 26May2022 04:34:
Yes it is in DataframeâŚ
Basically it the ledger entries dataset and after doing some brainstorming i managed to get debit and credit entries in one row with that one problem arise and im not able to resolve thatâŚ
Can you show the code which did this for you?
Also, can you show the original dataset?
The problem is that in debit column duplicate value are coming and its because of credit column value is are more than debit columnâŚ
My DataFrame abilities are weak, but in theory you could write a loop
which iterated over the frame rows, with a reference to the previous row
to hand. If the entry in the current row matches the previous row, you
could scrub the current rowâs value. Something a bit like this:
prev_row = None
for row in df:
if prev_row is not None and prev_row['Entry'] == row['Entry']:
row['Entry'] = ''
prev_row = row
You do not need to delete any values, Arvin. In fact you should not delete any values because these are financial data records. Even if youâre only trying to produce a report, that report will probably have errors if you modify the data or the output values just to make it âlook rightâ. Find the root cause instead of masking the actual bug by patching the output.
The specific problem is that the CreditAmount value doesnât match the DebitAmount value in the rows after the first âCashâ transaction.
It looks like something is making your CreditAmount pointer stop indexing. However, your dataset is so big that your output only shows the Head and Tail. NEXT STEP: Find the point where the CreditAmount value begins repeating.
THEN: Since your dataset has 91531 entries, be a friend to yourself and work with a smaller dataset. You should be able to test with a dataset having only two or three entries of each CreditVoucher type. See if you can make the bug happen with a much smaller dataset. Be sure to include the CreditVoucher types right before and after the point where the repeating begins.
The [repeating value] problem arises when the amount gets split.
This is a much better definition of the problem, Arvin!
Pandas is a Python package, but your question here is probably about Pandas instead of Python.
The first question to answer isâŚ
âCan Pandas do accounting transaction splits? Or do I need custom Python code for these splits?â
You will probably get better answers in a Pandas forum.
Post your question there as âAccounting Transaction Splitâ. This will attract the attention of people with accounting knowledge who will understand your application.
Your bug is âWhen I split a transaction, the source value (the Total value for the transaction) is repeated for each split. I need the source value to be zero on each split transaction line.â Look up each word in this quote and make sure you fully understand every word.
Make a simple dataset (with only the necessary columns) and post no more than 6 lines of the DATA over to that forum as TEXT characters, not screenshots. You can test a split with two lines. Post no more than three.
Post only the code that performs the split plus any code that allows a reader to understand the setup for the split. If this seems too difficult, then complete a simpler project before continuing with your accounting application.