-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from dominikzorgnotti/handling-kb2143838
Advanced data standardization Closing #3
- Loading branch information
Showing
5 changed files
with
84 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
__contact__ = "[email protected]" | ||
__license__ = "GPLv3" | ||
__status__ = "beta" | ||
__version__ = "0.0.3" | ||
__version__ = "0.1.0" | ||
|
||
|
||
import os | ||
|
@@ -37,6 +37,16 @@ def create_json_output(kb_dataobject, output_base_dir: str, record_type: str): | |
table_id = 0 | ||
for dataframe in kb_dataobject.list_of_dframes: | ||
filename = f"kb{kb_dataobject.id}_{kb_dataobject.fmt_product}_table{table_id}_release_as-{record_type}.json" | ||
# vRA KB | ||
if kb_dataobject.id == 2143850: | ||
dataframe = transform_kb2143850(dataframe) | ||
# General data optimization | ||
if ("BuildNumber" in dataframe.columns): | ||
dataframe.rename(columns={"BuildNumber": "Build Number"}, inplace=True) | ||
if ("Build number" in dataframe.columns): | ||
dataframe.rename(columns={"Build number": "Build Number"}, inplace=True) | ||
if "ReleaseDate" in dataframe.columns: | ||
dataframe.rename(columns={"ReleaseDate": "Release Date"}, inplace=True) | ||
if "Build Number" in dataframe.columns and record_type == "index": | ||
dataframe = transform_index(dataframe) | ||
dataframe.to_json( | ||
|
@@ -53,3 +63,10 @@ def transform_index(dataframe): | |
dataframe.reset_index(drop=True) | ||
dataframe.set_index("Build Number", inplace=True) | ||
return dataframe | ||
|
||
|
||
def transform_kb2143850(dataframe): | ||
"""Special handling of KB2143850 (vRA)""" | ||
if r"Build Number - Version" in dataframe: | ||
dataframe[["Build Number", "Version"]] = dataframe[r"Build Number - Version"].str.split(r" - ", expand=True) | ||
return dataframe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
__contact__ = "[email protected]" | ||
__license__ = "GPLv3" | ||
__status__ = "beta" | ||
__version__ = "0.0.3" | ||
__version__ = "0.1.0" | ||
|
||
# Imports | ||
from data_handling import create_json_output | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters