I have two dataframes. One called SERVICES and one called TIMES.
I am joining them together like so:
servicesMerged = pd.merge(services, times, left_on='Ref_Id', right_on='Ref_ID')
This is fine and works, except some of the TIMES data is missing a ref_id.
This is service data for a booking system, so for example we might have this:
**TIMES**
Ref_Id | TIMES
1 | 30
2 | 15
3 | 10
**SERVICES**
Ref_ID | Name
1 | Mowing
2 | Raking
3 | Blowing
4 | Trimming
What is happening, is we're getting a nice merge, but the service Trimming
does not come into the new dataset, as it's missing the time in the times dataframe.
What we need it to do, is, if the time is missing (as per this example) that we add some data, so we'd add say 15 minutes.
Something you would traditionally do like so:
If not exists time:
Create a time and make it 15
I've tried how = inner, outer, left, right, but nothing works.
How can I, if a row is missing like above, force the data to be added to the merged data?
Thank you.