Skip to content

This repository offers a streamlined solution for converting .prn (Print) files into .csv (Comma-Separated Values) format using Python. Designed for data analysts and developers, this tool simplifies the transformation of fixed-width text files into structured CSV files for easier data manipulation and analysis.

License

Notifications You must be signed in to change notification settings

AFJGitHubDev24/PRN-to-CSV-Conversion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PRN to CSV Conversion 📜 -> 💻

This repository offers a streamlined solution for converting .prn (Print) files into .csv (Comma-Separated Values) format using Python. Designed for data analysts and developers, this tool simplifies the transformation of fixed-width text files into structured CSV files for easier data manipulation and analysis.

🚀 Features

  • Flexible Parsing: Handles fixed-width .prn files with customizable field widths.
  • Automated Conversion: Processes multiple .prn files in batch mode.
  • Error Handling: Includes robust error checking and logging mechanisms.
  • User-Friendly Interface: Simple command-line interface for ease of use.

🛠️ Technologies Used

  • Python 3.8+: Core programming language for scripting and automation.
  • Pandas: Data manipulation and analysis library for handling tabular data.
  • NumPy: Supports numerical operations and array handling.
  • argparse: Facilitates command-line argument parsing.

📦 Installation

  1. Clone the Repository:

    git clone https://github.com/AFJGitHubDev24/PRN-to-CSV-Conversion.git
    cd PRN-to-CSV-Conversion
  2. Create a Virtual Environment (Optional but Recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install Dependencies:

    pip install -r requirements.txt

🔧 Usage

python prn_to_csv_converter.py --input_file path/to/input.prn --output_file path/to/output.csv

Command-Line Arguments:

  • --input_file: Path to the input .prn file.
  • --output_file: Desired path for the output .csv file.
  • --field_widths: (Optional) Comma-separated list of field widths.
  • --delimiter: (Optional) Delimiter for the output CSV file (default is comma).

Example:

python prn_to_csv_converter.py --input_file data/sample.prn --output_file data/output.csv --field_widths 10,15,20 --delimiter ","

📁 Project Structure

PRN-to-CSV-Conversion/
├── data/
│   ├── sample.prn
│   └── output.csv
├── prntocsv.py
├── requirements.txt
└── README.md

🧪 Testing

Note: Direct running of the Python code is enough!

To run the test suite:

python -m unittest discover tests

Ensure that all tests pass to validate the functionality of the converter.

📄 License

This project is licensed under the Creative Commons Zero v1.0 Universal license.

📬 Contact

For questions or suggestions, feel free to open an issue or contact AFJGitHubDev24.

Note:

The sample PRNs are unable to displayed as there is no direct option to open a PRN file due to it's binary-coded format!

About

This repository offers a streamlined solution for converting .prn (Print) files into .csv (Comma-Separated Values) format using Python. Designed for data analysts and developers, this tool simplifies the transformation of fixed-width text files into structured CSV files for easier data manipulation and analysis.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages