Data Discovery¶
Explore your Mixpanel project's schema before writing queries. Discovery results are cached for the session.
Explore on DeepWiki
🤖 Discovery Methods Guide →
Ask questions about schema exploration, caching behavior, or how to discover your data landscape.
Listing Events¶
Get all event names in your project:
Events are returned sorted alphabetically.
Listing Properties¶
Get properties for a specific event:
Properties include both event-specific and common properties.
Property Values¶
Sample values for a property:
Subproperties¶
Some Mixpanel event properties are lists of objects — for example, a cart property whose value is [{"Brand": "nike", "Category": "hats", "Price": 51}, ...]. The property_values() endpoint returns these as JSON-encoded strings, which makes them awkward to inspect by eye. subproperties() parses a sample of those blobs and infers a scalar type per inner key.
Results are alphabetically sorted by name. Subproperties whose values are themselves dicts/lists are silently skipped (only scalar sub-values are reportable). When a sub-key is observed with mixed scalar shapes, with both scalar and dict shapes, or with only null values, the call emits a UserWarning.
The discovered names and types feed directly into Filter.list_contains and GroupBy.list_item for filtering and breaking down by subproperty values.
SubPropertyInfo¶
sp.name # "Brand"
sp.type # "string" | "number" | "boolean" | "datetime"
sp.sample_values # ('nike', 'puma', 'h&m') — up to 5 distinct values
sp.to_dict() # {'name': 'Brand', 'type': 'string', 'sample_values': ['nike', ...]}
Saved Funnels¶
List funnels defined in Mixpanel:
FunnelInfo¶
Saved Cohorts¶
List cohorts defined in Mixpanel:
SavedCohort¶
c.id # 12345
c.name # "Power Users"
c.count # 5000
c.description # "Users with 10+ logins"
c.created # datetime
c.is_visible # True
Lexicon Schemas¶
Retrieve data dictionary schemas for events and profile properties. Schemas include descriptions, property types, and metadata defined in Mixpanel's Lexicon.
Schema Coverage
The Lexicon API returns only events/properties with explicit schemas (defined via API, CSV import, or UI). It does not return all events visible in Lexicon's UI.
Schema Registry CRUD
For write operations on the schema registry (create, update, delete schemas and enforcement configuration), see the Data Governance guide — Schema Registry.
# List all schemas
schemas = ws.lexicon_schemas()
for s in schemas:
print(f"{s.entity_type}: {s.name}")
# Filter by entity type
event_schemas = ws.lexicon_schemas(entity_type="event")
profile_schemas = ws.lexicon_schemas(entity_type="profile")
# Get a specific schema
schema = ws.lexicon_schema("event", "Purchase")
print(schema.schema_json.description)
for prop, info in schema.schema_json.properties.items():
print(f" {prop}: {info.type}")
LexiconSchema¶
s.entity_type # "event", "profile", or other API-returned types
s.name # "Purchase"
s.schema_json # LexiconDefinition object
LexiconDefinition¶
s.schema_json.description # "User completes a purchase"
s.schema_json.properties # dict[str, LexiconProperty]
s.schema_json.metadata # LexiconMetadata or None
LexiconProperty¶
prop = s.schema_json.properties["amount"]
prop.type # "number"
prop.description # "Purchase amount in USD"
prop.metadata # LexiconMetadata or None
LexiconMetadata¶
meta = s.schema_json.metadata
meta.display_name # "Purchase Event"
meta.tags # ["core", "revenue"]
meta.hidden # False
meta.dropped # False
meta.contacts # ["owner@company.com"]
meta.team_contacts # ["Analytics Team"]
Rate Limit
The Lexicon API has a strict rate limit of 5 requests per minute. Schema results are cached for the session to minimize API calls.
Write Operations
The Lexicon schemas shown here are read-only discovery methods. For full CRUD operations on Lexicon definitions (update, delete events/properties, manage tags, bulk updates), see the Data Governance guide.
Top Events¶
Get today's most active events:
TopEvent¶
Not Cached
Unlike other discovery methods, top_events() always makes an API call since it returns real-time data.
JQL-Based Remote Discovery¶
These methods use JQL (JavaScript Query Language) to analyze data directly on Mixpanel's servers, returning aggregated results without fetching raw data locally.
Property Value Distribution¶
Understand what values a property contains and how often they appear:
Numeric Property Summary¶
Get statistical summary for numeric properties:
Daily Event Counts¶
See event activity over time:
User Engagement Distribution¶
Understand how engaged users are by their event count:
Property Coverage¶
Check data quality by seeing how often properties are defined:
When to Use JQL-Based Discovery
These methods are ideal for:
- Quick exploration: Understand data shape before fetching locally
- Large date ranges: Analyze months of data without downloading everything
- Data quality checks: Verify property coverage and value distributions
- Trend analysis: See daily activity patterns
See the JQL Discovery Types in the API reference for return type details.
Caching¶
Discovery results are cached for the lifetime of the Workspace:
ws = mp.Workspace()
# First call hits the API
events1 = ws.events()
# Second call returns cached result (instant)
events2 = ws.events()
# Clear cache to force refresh
ws.clear_discovery_cache()
# Now hits API again
events3 = ws.events()
Discovery Workflow¶
A typical discovery workflow before analysis:
import mixpanel_data as mp
ws = mp.Workspace()
# 1. What events exist?
print("Events:")
for event in ws.events()[:10]:
print(f" - {event}")
# 2. What properties does Purchase have?
print("\nPurchase properties:")
for prop in ws.properties("Purchase"):
print(f" - {prop}")
# 3. What values does 'country' have?
print("\nCountry values:")
for value in ws.property_values("country", event="Purchase", limit=10):
print(f" - {value}")
# 4. What funnels are defined?
print("\nFunnels:")
for f in ws.funnels():
print(f" - {f.name} (ID: {f.funnel_id})")
# 5. Run a live query with discovered data
result = ws.segmentation(
event="Purchase",
from_date="2025-01-01",
to_date="2025-01-31",
on="country"
)
print(result.df)
Next Steps¶
- Streaming Data — Stream events and profiles
- API Reference — Complete API documentation