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: Đọc output/kết quả từ cell trước đó và ghi thẳng kết quả nhận xét vào trong cell (không in output).
  2. %%cd: Chuẩn hóa code trong cell theo chuẩn PEP 8, giữ nguyên toàn bộ comment và ghi thẳng vào cell (không in output).

🚀 Cài đặt

pip install cdpd

⚙️ Cấu hình

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"

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

import cdpd

%cdpd YOUR_GEMINI_API_KEY
# Hoặc truyền mật khẩu 10 ký tự nếu đã nhúng key mã hóa:
%cdpd MyPass1234

📖 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 mới ngay bên dưới để yêu cầu 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ả: Khi chạy, nội dung cell sẽ được thay thế trực tiếp bằng câu trả lời của AI, không in ra phần output. Bạn có thể bấm phím tắt M để chuyển cell này thành Cell Markdown nếu muốn!


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

Thêm %%cd ở đầu cell cần format:

%%cd
# Comment này sẽ được giữ nguyên 100%
def tinh_tong( a,b ):
    x=a+b;return x

💡 Kết quả: Code sẽ được viết lại chuẩn PEP 8 ngay trong cell, comment được giữ nguyên vẹn và không sinh ra output thừa.


📄 License

MIT License. See LICENSE for details.

Metadata

Release files for cdpd 0.1.9

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.9
File Size Uploaded Provenance Actions
cdpd-0.1.9.tar.gz 8.5 kB Without provenance Details for cdpd-0.1.9.tar.gz

Built distribution (wheel)

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

Total release size: 17.1 kB

Release files / cdpd-0.1.9.tar.gz

Download URL cdpd-0.1.9.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
db75faec46f8d9bd1311dc4308694ea98bf337185b8f4b1ad6708ab361ec211c
BLAKE2b-256 checksum
How to use checksums
b41167b02cac908aba752f1e30a4bfbd0628d18b3347437794a0d01c34a97ea5
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.9-py3-none-any.whl

Download URL cdpd-0.1.9-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4dbe6d53acb36eb1fa1b6feade423704b14a1bc50ecfcbeb4fd9b31874f4fe3
BLAKE2b-256 checksum
How to use checksums
0bb874d5e8aadfe3ddd58c96f905a71bdea1284887aea8ec5b1155d071a88eac
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.9

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