Skip to main content

✨ Darsh

Built on pandas and matplotlib, not instead of them.

PyPI - Version License: MIT Python Versions


North Star: Darsh is a skin and convenience layer over pandas and matplotlib — not a replacement for them. Every Darsh call returns a real pandas.DataFrame, matplotlib.axes.Axes, or plotly.graph_objects.Figure so you never lose access to the ecosystem you already know and trust.

No proprietary DataFrame wrappers. No black-box chart objects. Just clean ergonomics registered via pandas' sanctioned df.darsh accessor.

import pandas as pd
import darsh

# 1. Load data with standard pandas — 100% native
df = pd.read_csv("sales.csv")

# 2. Clean effortlessly with chainable, explainable methods
df = (
    df.darsh.clean_names()
    .darsh.fill_missing(strategy="smart")
    .darsh.handle_outliers(columns=["price"], action="clip")
)

# 3. Use standard pandas methods anywhere in the chain
top_regions = df.groupby("region")["revenue"].sum().reset_index()

# 4. Generate styled matplotlib charts — returns real matplotlib.axes.Axes!
ax = top_regions.darsh.bar(x="region", y="revenue", title="Regional Revenue")

# 5. Native matplotlib methods work seamlessly
ax.figure.savefig("revenue.png", dpi=300)

⚡ Installation

pip install darsh

Dependencies: pandas>=2.0, matplotlib>=3.7, plotly>=5.0, fastapi>=0.100, uvicorn>=0.23.


🧼 Transparent Data Cleaning

Every cleaning method returns a real pandas.DataFrame and adheres to transparent, documented behavior:

df = (
    df.darsh.clean_names()                          # standardizes to snake_case identifiers
      .darsh.drop_duplicates()                      # removes exact duplicate rows
      .darsh.fill_missing(strategy="smart")         # median for numeric, mode for text; columns >30% missing untouched
      .darsh.handle_outliers(columns=["revenue"], action="clip") # IQR clipping
      .darsh.clean_text(columns=["notes"])          # strips whitespace, lowercases
      .darsh.add_date_features(columns=["order_date"]) # extracts year, month, day_name, is_weekend
      .darsh.infer_types()                          # casts dates, downcasts numerics, categorical optimization
)

Explainable Defaults

No silent, unexplainable mutations. For instance, fill_missing(strategy="smart") rules are plain English:

  • Numeric columns: Imputed using column median.
  • Text / Categorical columns: Imputed using column mode (or "Unknown" if no mode exists).
  • Columns with >30% missing data: Left untouched and flagged in .darsh.profile() rather than distorted.

🔍 Explainable Profiling & Quality Scoring

# Detailed tabular profile: dtype, % missing, cardinality, skew, and outlier count
profile_df = df.darsh.profile()
print(profile_df)

# Inspectable quality score (0 - 100)
score = df.darsh.quality_score()
print(f"Score: {score:.1f}/100")

# Plain-English diagnostic breakdown of score deductions
print(score.explain())

Example .explain() output:

Darsh Data Quality Score: 92.4/100.0
============================================
Identified 2 issue(s) affecting score:
  1. [Missing Data] Column 'customer_notes': -3.2 pts — 14 missing value(s) (4.2% missing)
  2. [Outliers] Column 'revenue': -4.4 pts — 18 outlier(s) (5.4% outside 1.5*IQR)
--------------------------------------------
Base: 100.0 | Total Deductions: -7.6 | Final: 92.4

📊 Visualizations: Matplotlib 2D & Plotly 3D

2D Charts (Matplotlib)

All 2D chart methods return real matplotlib.axes.Axes, accept optional ax=, and apply modern typography, palettes, and whitespace automatically:

import matplotlib.pyplot as plt

# Standalone or embedded in subplots
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 5))

df.darsh.line(x="date", y="sales", title="Daily Trend", ax=ax1)
df.darsh.bar(x="category", y="sales", title="Category Sales", ax=ax2)

plt.tight_layout()
plt.show()

Available 2D chart methods:

  • df.darsh.line(x=..., y=..., title=..., ax=...)
  • df.darsh.bar(x=..., y=..., title=..., horizontal=False, ax=...)
  • df.darsh.scatter(x=..., y=..., size=..., color=..., ax=...)
  • df.darsh.donut(values=..., names=..., hole=0.55, ax=...)

3D Charts (Plotly)

Clearly labeled, Plotly-backed 3D visualizations returning real plotly.graph_objects.Figure:

fig = df.darsh.scatter_3d(x="price", y="units", z="margin", color="category")
fig.show()

Available 3D chart methods:

  • df.darsh.scatter_3d(x, y, z, color=None, size=None)
  • df.darsh.line_3d(x, y, z, color=None)
  • df.darsh.bar_3d(x, y, z)

🚀 One Unified Dashboard API

No competing OOP vs. procedural paradigms. Create dashboards directly using the charts and DataFrame you've already built:

import darsh

# 1. Create your charts
ax1 = df.darsh.line(x="order_date", y="revenue", title="Revenue Trend")
ax2 = df.darsh.bar(x="region", y="revenue", title="Revenue by Region")

# 2. Build dashboard with KPIs and reactive filter controls
app = darsh.dashboard(
    title="Sales Intelligence Hub",
    charts=[ax1, ax2],
    data=df,
    kpis=[
        darsh.kpi(label="Total Revenue", value=df["revenue"].sum(), delta="+12.4%"),
        darsh.kpi(label="Avg Order Value", value=df["revenue"].mean()),
        darsh.kpi(label="Orders", value=len(df)),
    ],
    filters=["region", "category"],
    theme="light",
)

# 3. Run the interactive local server
app.run(port=8501, open_browser=True)

# Or export standalone HTML
app.save_html("dashboard.html")

When users select filter values in the web UI, Darsh automatically filters the backing DataFrame and re-renders the charts in real-time.


🛡️ License

MIT License © 2026 Satyam Rana.

Metadata

Release files for darsh 2.0.1

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

Source distribution (sdist)

Source distribution for darsh 2.0.1
File Size Uploaded Provenance Actions
darsh-2.0.1.tar.gz 39.7 kB Without provenance Details for darsh-2.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 73.1 kB

Release files / darsh-2.0.1.tar.gz

Download URL darsh-2.0.1.tar.gz
Size 39.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c46bfa06db8d078d712d87975478cda3f15525512e49c5a03174dec5d41fbc74
BLAKE2b-256 checksum
How to use checksums
3eb23c8bffd3f73b7bf9802a6f31695966b9bf845e9a639ac3fce3ada111ab2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / darsh-2.0.1-py3-none-any.whl

Download URL darsh-2.0.1-py3-none-any.whl
Size 33.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7cbd12e79d4a627176eec2f3c9e62fa1428046a6d4187f184112ba20d8167c3
BLAKE2b-256 checksum
How to use checksums
6a14f741fd0524140295f748e0d1f2b2c0b99dbdb1dfb083675b56d81c4bd4ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for darsh 2.0.1

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