Python Forum
Match a table with sub-total values to its detail value table
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Match a table with sub-total values to its detail value table
#3
Hi there,
I'm still facing this same problem. Subtotals needs to matched with details table and also there can be mismatching items in detail table.
import pandas as pd
import datetime as dt
   
subtotal = pd.DataFrame(data = {'Date':['21/09/2018  17:45:27','21/09/2018  18:59:24','21/09/2018  20:42:03'],
                             'Amount':[2000,3000,6000],
                             'Ref':[1,2,3]},columns=['Date', 'Amount', 'Ref'])
 
detail = pd.DataFrame(data = {'Date':['21/09/2018  17:37:05','21/09/2018  17:56:22','21/09/2018  17:56:53','21/09/2018  18:54:56','21/09/2018 19:12:56','21/09/2018 19:30:30 ','21/09/2018 21:35:59','21/09/2018  21:36:20','21/09/2018 21:43:32 '],
                             'Amount':[1000,500,500,1000,3000,12000,1000,2000,3000]},
                                columns=['Date', 'Amount'])
My expected result is a table like this
Output:
Table2 Ref DateTime Value Result 1 09/21/2018 17:37 1,000.00 Index1 2 09/21/2018 17:56 500.00 Index1 3 09/21/2018 17:56 500.00 Index1 4 09/21/2018 18:54 1,000.00 Index2 5 09/21/2018 19:12 2,000.00 Index2 6 09/21/2018 19:30 12,000.00 No Match 7 09/21/2018 21:35 1,000.00 Index3 8 09/21/2018 21:36 2,000.00 Index3 9 09/21/2018 21:43 3,000.00 Index3
Reply


Messages In This Thread
RE: Match a table with sub-total values to its detail value table - by klllmmm - Apr-03-2019, 11:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Simple linear regression with interaction summary table Andrzej_Andrzej 0 305 Feb-21-2024, 07:44 AM
Last Post: Andrzej_Andrzej
  Extracting tables and text above the table from a PDF to CSV DivAsh 3 2,506 Jan-18-2023, 07:39 AM
Last Post: perfringo
  How to write table to different sheet in openpyxl rsearing 2 2,103 Aug-22-2022, 11:59 PM
Last Post: Pedroski55
  Create a Table to a PNG file amanajosh 0 1,098 Aug-11-2022, 02:54 AM
Last Post: amanajosh
  Chi-square with the contingency table applied to the die Leloup 4 1,992 Mar-16-2022, 12:22 AM
Last Post: jefsummers
  pivot table (excel vs python) Bric 1 1,679 Feb-02-2022, 11:04 PM
Last Post: Bric
Question How does one clean a populated table in MySQL/MariaDB? Copying values across tables? BrandonKastning 2 1,580 Jan-17-2022, 05:46 AM
Last Post: BrandonKastning
  How do I use bounding box to locate a table in a pdf file? JaneTan 1 2,520 Sep-01-2021, 05:44 PM
Last Post: Larz60+
  Identify anomalies in a payment detail dataset for a period klllmmm 1 1,913 Aug-05-2021, 09:41 AM
Last Post: Larz60+
  How to set the font size for a pandas table? AlekseyPython 0 2,336 Feb-06-2021, 03:37 AM
Last Post: AlekseyPython

Forum Jump:

User Panel Messages

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