From 6570fb7fe74d1971e5e2902b69dc4c239f4b30aa Mon Sep 17 00:00:00 2001 From: Paul Runco <runco.paul@gmail.com> Date: Wed, 23 Nov 2022 12:30:38 -0500 Subject: [PATCH] fix: type conversions in index columns --- CHANGELOG.md | 4 ++++ functions.py | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bb0ea6..96f9a8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project attempts to adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.1.1] - 2022-11-23 +### Fixed +- A type conversion in the index columns which was causing the lookup (join) of promise dates to fail + ## [1.1.0] - 2022-06-10 ### Added - Feature to detect and fix Excel-formatted dates in the input data diff --git a/functions.py b/functions.py index 51e0d30..0b85b09 100644 --- a/functions.py +++ b/functions.py @@ -11,13 +11,21 @@ def update_report(path_to_date_verification, path_to_estimated_completion, trans sheet_name='Requested Updates' )) + # Create an index column using order-release + promise_date['Order-Line'] = promise_date['PO #'].astype(str) + '-' + promise_date['Line #'].astype(str) + promise_date = promise_date.set_index(['Order-Line']) + ## Make a dataframe of the input data estimated_date = pd.DataFrame(pd.read_excel( path_to_estimated_completion, header=0, sheet_name=0, usecols='A:H' - )).set_index(['PO', 'Line']) + )) + + # Create an index column using order-release + estimated_date['Order-Line'] = estimated_date['PO'].astype(str) + '-' + estimated_date['Line'].astype(str) + estimated_date = estimated_date.set_index(['Order-Line']) ## Find and fix Excel-formatted dates @@ -38,7 +46,7 @@ def update_report(path_to_date_verification, path_to_estimated_completion, trans ## Look up estimated completion dates from scheduling sheet promise_date = promise_date.join( estimated_date['Estimated Ship Date'], - on=['PO #', 'Line #']) + on=['Order-Line']) # Update promise dates if include_weekends: