Unpivot-Convert is a Python script designed to streamline the transformation of Excel product data from a long (unpivoted) format to a wide format. In the original data structure, multiple rows are used for each unique identifier (EAN, SKU, etc.), along with associated categories and values. The script reshapes this data into a more traditional pivoted format, where each unique identifier has its own row, and categories are represented as separate columns.
- Data Reshaping: Converts long-format Excel product data into a wide-format for improved readability and analysis.
- Enriched/Existing Values: The script intelligently handles enriched/existing values during the conversion process, ensuring that prior data enrichment is seamlessly incorporated into the transformed dataset.
- Ease of Analysis: Facilitates easy analysis of product data with a structured and intuitive layout.
-
Clone the repository:
git clone https://github.com/sfeddahi/unpivot-convert.git
-
Install the required Python libraries:
pip install pandas openpyxl
-
Execute the script:
python unpivot_convert.py path_to_input_data.xlsx path_to_output_data.xlsx
- Replace
path_to_input_data.xlsx
with the path to your source Excel file. - Replace
path_to_output_data.xlsx
with the desired path for the resulting pivoted Excel file.
- Replace
# Example usage
# python unpivot_convert.py path/to/input_data.xlsx path/to/output_data.xlsx
The script is designed to intelligently handle enriched and existing values during the conversion process. If values have been enriched before the conversion, the script ensures a seamless integration, updating the pivoted dataset with the enriched information.
Contributions are welcome! If you encounter any issues or wish to enhance the functionality, feel free to submit a pull request.
This project is licensed under the MIT License - see the MIT-LICENSE file for details.