Skip to main content

Generate, convert and manage DataFrames easily — perfect for devs and teachers.

Project description

🧪 DFAlchemy

The Alchemy of DataFrames — For Teachers, Students, and Developers.
A Python library to rapidly create, convert, and manipulate Pandas DataFrames with ease.


🚀 What is DFAlchemy?

DFAlchemy is a lightweight and powerful module that simplifies working with Pandas DataFrames. Whether you're a teacher trying to demonstrate a concept, or a developer quickly testing logic — DFAlchemy helps you create DataFrames magically from lists, dicts, JSONs, CSVs, or even fake data.


🎯 Key Features

📚 For Teachers

  • generate_students_dataframe(n=10) – Creates realistic student records (names, marks, attendance).
  • generate_sales_dataframe(n=20) – Sample sales data (product, price, quantity, revenue).
  • generate_dates_dataframe(n=15, freq='D') – Create datetime-based DataFrames.
  • generate_null_dataframe() – Showcase missing value handling.
  • generate_multiindex_example() – Pre-made multi-indexed DataFrame for teaching.

👨‍💻 For Developers

  • to_dataframe(obj) – One function to convert lists, dicts, CSVs, JSON, etc. to DataFrame.
  • load_csv(path) – Safe wrapper around pd.read_csv.
  • load_json(path) – Load JSON files into DataFrames easily.
  • preview(df, max_rows=5) – Preview DataFrames in a clean, tabular CLI format.
  • save_df(df, path, format='csv') – Save to CSV/JSON with one line.
  • compare_dfs(df1, df2) – Diff two DataFrames for fast debugging.

🧙‍♂️ Magic Data Creation

  • fake_data(cols=['name', 'email', 'address'], n=10) – Generate fully fake but realistic data using Faker.

🖼️ (Planned) Visual + Advanced Features

  • theme.set('dark') – Pretty terminal output using themes.
  • from_api(url) – Convert JSON API response to DataFrame.
  • from_sql(query, uri) – Load directly from SQL databases (SQLite, MySQL, etc.)
  • plot_dataframe(df) – (Optional) Plot sample visualizations using matplotlib/seaborn.

🔧 Installation

pip install dfalchemy

🧪 Example Usage

from dfalchemy.generators import fake_data
from dfalchemy.converters import to_dataframe

# Generate 5 fake records with names and emails
df = fake_data(cols=['name', 'email'], n=5)
print(df)

# Convert a list of dicts to DataFrame
data = [{'name': 'Alice'}, {'name': 'Bob'}]
df2 = to_dataframe(data)
print(df2)

🧩 Project Structure

dfalchemy/
├── __init__.py
├── generators.py       # fake_data, generate_students_dataframe, etc.
├── converters.py       # list/dict/json → DataFrame
├── loaders.py          # CSV/JSON → DataFrame
├── utils.py            # preview, compare, save

🤝 Contributing

We welcome suggestions, pull requests, and feature ideas!

  1. Fork the repo
  2. Create a new branch
  3. Add your changes
  4. Submit a pull request

📜 License

This project is licensed under the MIT License — see the LICENSE file for details.


💬 Credits

Made with ❤️ by Bhavya Soni a.k.a zGamingTechz For teachers, students, devs, and data lovers.


Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dfalchemy-1.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dfalchemy-1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file dfalchemy-1.0.tar.gz.

File metadata

  • Download URL: dfalchemy-1.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.0

File hashes

Hashes for dfalchemy-1.0.tar.gz
Algorithm Hash digest
SHA256 243ea548b718f7ab61108b8b885416954eee6dee7ef76125ff66bfa9d08147a4
MD5 9d9f25c08d69fc8c974d03e1dd39db6d
BLAKE2b-256 1c1d550790ce76d9d25fc8c617fd39b1ede952dca71aa6fd63ad5a603b1dc7a9

See more details on using hashes here.

File details

Details for the file dfalchemy-1.0-py3-none-any.whl.

File metadata

  • Download URL: dfalchemy-1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.0

File hashes

Hashes for dfalchemy-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e346de55d92e8bb5bddc8b45d1fb85adbab9adee80fb39cc947bb6cc30ecf43e
MD5 07b1cc4b46e738ef957e907f47ecd97f
BLAKE2b-256 70908b05743d7e0db96fb89f54977e10c13cb23612906e7fd4d90aa80a60bd80

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page