Skip to content

Repository files navigation

Data Handling with Pandas

Description

This repository contains Python scripts for working with files, JSON, and SQL databases. It includes methods to read, write, and manipulate files, interact with SQL databases using MySQL, and handle JSON data efficiently.

Features

  • Read and write files using Python
  • Work with JSON data
  • Connect to MySQL databases using PHPMyAdmin
  • Execute SQL queries on a world database

Setup Instructions

For Working with SQL

  1. Create Database:

    • Go to the PHPMyAdmin panel.
    • Create a new database named world.
    • Download the dataset from Kaggle: World Cities SQL Dataset.
    • Upload the downloaded SQL file into your world database.

    Database Creation

  2. Start Services:

    • Run the Apache server and MySQL to implement the code in Python.

    Starting Apache & MySQL

  3. Execute Queries:

    • Run Python scripts to interact with the database and execute queries.

    Query Execution

  4. Database Overview:

    • The world database contains three datasets.

    Database Structure

For Working with JSON

  • Reading JSON: Load and parse JSON data using Python.
import json

with open('data.json', 'r') as file:
    data = json.load(file)
print(data)
  • Writing JSON: Save data into a JSON file.
import json

data = {"name": "Alice", "age": 25, "city": "New York"}

with open('data.json', 'w') as file:
    json.dump(data, file, indent=4)

Requirements

  • Python 3.x
  • MySQL
  • PHPMyAdmin (for SQL database management)
  • Apache Server (for running MySQL and PHPMyAdmin)

How to Run

  1. Clone the repository:
    git clone <repo-url>
    cd <repo-folder>
  2. Install dependencies (if any).
  3. Follow the setup instructions above for SQL and JSON.
  4. Run Python scripts as needed:
    python script.py

License

This project is open-source and available under the MIT License.

About

This repository contains Python scripts for handling various data formats, such as CSV, JSON, and SQL databases. It includes examples on how to read, manipulate, and write data from files, interact with MySQL databases, and work with JSON data efficiently using Python and Pandas.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages