Urgent.News

What's breaking now, across thousands of outlets.

Tech

Data Cleaning Microservice: FastAPI + Pandas + Docker

A high-performance, containerized Python microservice designed to ingest messy CSV files, clean the data using Pandas, and return a structured JSON response. This project demonstrates how to build and containerize a modern, asynchronous API capable of handling data transformation pipelines. Architecture FastAPI : A modern, fast (high-performance) web framework for building APIs with Python, built…

The microservice, developed by Marcela Zapata Vanegas, utilizes FastAPI, Pandas, and Docker to efficiently process messy CSV files, clean the data using Pandas, and return a structured JSON response. FastAPI is a modern, high-performance web framework for building APIs with Python, while Pandas is the industry-standard Python library for data manipulation and analysis. Docker is used to containerize the microservice, ensuring environment consistency and easy deployment on various cloud providers.

To begin, ensure Docker Desktop and Git are installed on your local machine. Clone the repository by running 'git clone https://github.com/whoismarce/proyecto-fastapi-csv.git', then navigate into the project directory with 'cd proyecto-fastapi-csv'. Build the Docker image by executing 'docker build -t fastapi-limpiador .', which downloads the Python base image and installs the necessary dependencies, including FastAPI, Pandas, and Uvicorn.

To run the microservice, use the command 'docker run -d -p 8000:8000 --name api_python fastapi-limpiador', spinning up the container in detached mode on port 8000. Access the API documentation via Swagger UI by navigating to 'http://localhost:8000/docs' in your web browser. Select the 'POST /clean' endpoint, upload the provided 'datos_sucios.csv' file, and click 'Execute' to observe the service transforming the messy CSV data into clean, structured JSON format.

To stop the microservice and remove the container, run 'docker stop api_python' followed by 'docker rm api_python'. This ensures the environment remains clean and resources are freed up.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

F-Droid 2.0: A new chapter for Android freedom

The F-Droid project has announced the release of F-Droid 2.0, which is a complete redesign of the official app. Notable changes in the release include making it easier to discover and install…

  • F-Droid releases version 2.0, major overhaul for Android users
  • Introduces modern interface, improved app discovery, refined search
  • Redesigned using Kotlin Compose for future enhancements

More from Thursday 24 September →