python
17 lines · 1 tab
Dr. Elena Vasquez
Apr 2026
1 tab
import pandas as pd
import plotly.express as px
df = pd.read_csv('marketing_performance.csv')
fig = px.scatter(
df,
x='spend',
y='revenue',
size='conversions',
color='channel',
hover_data=['campaign_name', 'region'],
trendline='ols',
title='Campaign efficiency overview',
)
fig.update_layout(template='plotly_white')
fig.show()
1 file · python
Explain with highlit
Static plots are fine for papers, but product and business reviews often benefit from interactive filtering and hover details. I use Plotly when I need fast exploratory dashboards without spinning up a full app. It is especially useful for cohort analysis, anomaly inspection, and notebook demos that people actually engage with.
Related snips
yaml
# Grafana provisioning: datasources
# /etc/grafana/provisioning/datasources/prometheus.yml
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
Grafana dashboards as code with JSON provisioning
grafana
dashboards
monitoring
by Ryan Nakamura
2 tabs
python
from django.db.models import F, Window
from django.db.models.functions import RowNumber, Rank, DenseRank
from products.models import Sale
def get_sales_with_ranking():
Django ORM window functions for analytics
django
python
database
by Priya Sharma
1 tab
ruby
class ShardedCounter
SHARDS = 16
SNAPSHOT_TTL = 10 # seconds
def initialize(name, redis: REDIS)
@name = name
Lock-Free Read Pattern for Hot Counters (Approximate)
rails
redis
performance
by codesnips
3 tabs
sql
-- ROW_NUMBER: Unique sequential number
SELECT
name,
department,
salary,
ROW_NUMBER() OVER (ORDER BY salary DESC) as overall_rank,
Window functions for advanced analytics
sql
window-functions
analytics
by Maria Garcia
2 tabs
sql
WITH ordered_events AS (
SELECT
customer_id,
event_time,
revenue,
ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY event_time DESC) AS event_rank,
SQL window functions for feature extraction and behavioral ranking
sql
window-functions
feature-engineering
by Dr. Elena Vasquez
1 tab
python
import pandas as pd
df = pd.read_parquet('events.parquet')
df['event_date'] = pd.to_datetime(df['event_date'])
df['month'] = df['event_date'].dt.to_period('M').astype(str)
GroupBy aggregations and pivot tables for business reporting
pandas
groupby
pivot-table
by Dr. Elena Vasquez
1 tab
Share this code
Here's the card — post it anywhere.