Skip to main content

cdpd

Thư viện IPython / Jupyter Cell Magic hỗ trợ lập trình và phân tích dữ liệu với Google Gemini:

  1. %%pd: Tự động đọc output/kết quả từ cell trước đó và in nhận xét ngắn gọn, đủ ý dưới dạng văn bản để bạn dễ dàng copy dán vào các cell Markdown báo cáo.
  2. %%cd: Tự động định dạng, tối ưu và chuẩn hóa code trong cell theo chuẩn PEP 8.

🚀 Cài đặt

pip install cdpd

⚙️ Cấu hình (Cực kỳ ngắn gọn)

Bạn có thể cấu hình nhanh bằng một trong các cách sau:

Cách 1: Dùng hàm cdpd.set() (Khuyến nghị)

import cdpd

# Chỉ cần set key:
cdpd.set("YOUR_GEMINI_API_KEY")

# Hoặc set cả key lẫn model cùng lúc:
cdpd.set("YOUR_GEMINI_API_KEY", "gemini-3.1-flash-lite")

Cách 2: Gán biến trực tiếp

import cdpd

cdpd.api_key = "YOUR_GEMINI_API_KEY"
cdpd.model = "gemini-3.1-flash-lite"  # (tùy chọn)

Cách 3: Dùng Line Magic %cdpd trực tiếp trong Notebook

import cdpd

%cdpd YOUR_GEMINI_API_KEY

Cách 4: Qua biến môi trường

export GEMINI_API_KEY="YOUR_GEMINI_API_KEY"

📖 Hướng dẫn sử dụng

1. Phân tích & Nhận xét số liệu (%%pd)

Sau khi chạy 1 cell sinh ra số liệu, biểu đồ hoặc DataFrame:

# [Cell 1 - Code tính toán]
df.describe()

Mở cell code mới ngay bên dưới để hỏi nhận xét:

# [Cell 2]
%%pd
Nhận xét về độ lệch chuẩn và các giá trị bất thường của bảng số liệu trên.

💡 Kết quả: Gemini sẽ in nhận xét dạng text thuần. Bạn chỉ cần bôi đen, copy và dán vào cell Markdown để làm báo cáo/thuyết minh.


2. Chuẩn hóa & Format code (%%cd)

Thêm %%cd ở dòng đầu của cell code cần format:

%%cd
def tinh_tong( a,b ):
    x=a+b;return x

📄 License

MIT License. See LICENSE for details.

Metadata

Release files for cdpd 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cdpd 0.1.0
File Size Uploaded Provenance Actions
cdpd-0.1.0.tar.gz 5.8 kB Without provenance Details for cdpd-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cdpd 0.1.0
File Interpreter ABI Platform Actions
cdpd-0.1.0-py3-none-any.whl Python 3 none any Details for cdpd-0.1.0-py3-none-any.whl

Total release size: 11.7 kB

Release files / cdpd-0.1.0.tar.gz

Download URL cdpd-0.1.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f1a97fe0dad497393fadb4fbfaa35e9911a7436b8a699b89e9598ef519a0b585
BLAKE2b-256 checksum
How to use checksums
f6934ff7d751ecf22175ee39778faed8eb6ab79fa3c516e7e47b6c5f5706d042
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.0

Release files / cdpd-0.1.0-py3-none-any.whl

Download URL cdpd-0.1.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2878d51225b6e58211c95aab5464fe327c4b7c68ab076bcaf143fb3d6c254bb9
BLAKE2b-256 checksum
How to use checksums
210f54d5cdbbed43983725de4572952e9a9836919daf4e826c2304f92d7f14e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.0

Security for cdpd 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page