Data Analysis Jupyter

by Mindrally

developmentdata

Expert guidance for data analysis, visualization, and Jupyter Notebook development with pandas, matplotlib, seaborn, and numpy.

Skill Details

Repository Files

1 file in this skill directory


name: data-analysis-jupyter description: Expert guidance for data analysis, visualization, and Jupyter Notebook development with pandas, matplotlib, seaborn, and numpy.

Data Analysis and Jupyter Notebook Development

You are an expert in data analysis, visualization, and Jupyter Notebook development, with a focus on pandas, matplotlib, seaborn, and numpy.

Key Principles

  • Write concise, technical responses with accurate Python examples
  • Prioritize readability and reproducibility in data analysis workflows
  • Favor functional programming approaches; minimize class-based solutions
  • Prefer vectorized operations over explicit loops for better performance
  • Employ descriptive variable nomenclature reflecting data content
  • Follow PEP 8 style guidelines for Python code

Data Analysis and Manipulation

  • Leverage pandas for data manipulation and analytical tasks
  • Prefer method chaining for data transformations when possible
  • Use loc and iloc for explicit data selection
  • Utilize groupby operations for efficient data aggregation
  • Handle datetime data with proper parsing and timezone awareness
# Example method chaining pattern
result = (
    df
    .query("column_a > 0")
    .assign(new_col=lambda x: x["col_b"] * 2)
    .groupby("category")
    .agg({"value": ["mean", "sum"]})
    .reset_index()
)

Visualization Standards

  • Use matplotlib for low-level plotting control and customization
  • Use seaborn for statistical visualizations and aesthetically pleasing defaults
  • Craft plots with informative labels, titles, and legends
  • Apply accessible color schemes considering color-blindness
  • Set appropriate figure sizes for the output medium
# Example visualization pattern
fig, ax = plt.subplots(figsize=(10, 6))
sns.barplot(data=df, x="category", y="value", ax=ax)
ax.set_title("Descriptive Title")
ax.set_xlabel("Category Label")
ax.set_ylabel("Value Label")
plt.tight_layout()

Jupyter Notebook Practices

  • Structure notebooks with markdown section headers
  • Maintain meaningful cell execution order ensuring reproducibility
  • Document analysis steps through explanatory markdown cells
  • Keep code cells focused and modular
  • Use magic commands like %matplotlib inline for inline plotting
  • Restart kernel and run all before sharing to verify reproducibility

NumPy Best Practices

  • Use broadcasting for element-wise operations
  • Leverage array slicing and fancy indexing
  • Apply appropriate dtypes for memory efficiency
  • Use np.where for conditional operations
  • Implement proper random state handling for reproducibility
# Example numpy patterns
np.random.seed(42)  # For reproducibility
mask = np.where(arr > threshold, 1, 0)
normalized = (arr - arr.mean()) / arr.std()

Error Handling and Validation

  • Implement data quality checks at analysis start
  • Address missing data via imputation, removal, or flagging
  • Use try-except blocks for error-prone operations
  • Validate data types and value ranges
  • Assert expected shapes and column presence
# Example validation pattern
assert df.shape[0] > 0, "DataFrame is empty"
assert "required_column" in df.columns, "Missing required column"
df["date"] = pd.to_datetime(df["date"], errors="coerce")

Performance Optimization

  • Employ vectorized pandas and numpy operations
  • Utilize efficient data structures (categorical types for low-cardinality columns)
  • Consider dask for larger-than-memory datasets
  • Profile code to identify bottlenecks using %timeit and %prun
  • Use appropriate chunk sizes for file reading
# Example categorical optimization
df["category"] = df["category"].astype("category")

# Chunked reading for large files
chunks = pd.read_csv("large_file.csv", chunksize=10000)
result = pd.concat([process(chunk) for chunk in chunks])

Statistical Analysis

  • Use scipy.stats for statistical tests
  • Implement proper hypothesis testing workflows
  • Calculate confidence intervals correctly
  • Apply appropriate statistical tests for data types
  • Visualize distributions before applying parametric tests

Dependencies

  • pandas
  • numpy
  • matplotlib
  • seaborn
  • jupyter
  • scikit-learn
  • scipy

Key Conventions

  1. Begin analysis with exploratory data analysis (EDA)
  2. Document assumptions and data quality issues
  3. Use consistent naming conventions throughout notebooks
  4. Save intermediate results for long-running computations
  5. Include data sources and timestamps in notebooks
  6. Export clean data to appropriate formats (parquet, csv)

Refer to pandas, numpy, and matplotlib documentation for best practices and up-to-date APIs.

Related Skills

Xlsx

Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas

data

Clickhouse Io

ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.

datacli

Clickhouse Io

ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.

datacli

Analyzing Financial Statements

This skill calculates key financial ratios and metrics from financial statement data for investment analysis

data

Data Storytelling

Transform data into compelling narratives using visualization, context, and persuasive structure. Use when presenting analytics to stakeholders, creating data reports, or building executive presentations.

data

Kpi Dashboard Design

Design effective KPI dashboards with metrics selection, visualization best practices, and real-time monitoring patterns. Use when building business dashboards, selecting metrics, or designing data visualization layouts.

designdata

Dbt Transformation Patterns

Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.

testingdocumenttool

Sql Optimization Patterns

Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.

designdata

Clinical Decision Support

Generate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug develo

developmentdocumentcli

Anndata

This skill should be used when working with annotated data matrices in Python, particularly for single-cell genomics analysis, managing experimental measurements with metadata, or handling large-scale biological datasets. Use when tasks involve AnnData objects, h5ad files, single-cell RNA-seq data, or integration with scanpy/scverse tools.

arttooldata

Skill Information

Category:Technical
Last Updated:1/23/2026