Advanced Techniques
Master advanced PXL patterns using the available functions and complex filtering expressions.
Available PXL Functions
Section titled “Available PXL Functions”PXL provides six core functions for data transformation and text analysis:
Data Functions
Section titled “Data Functions”- filter(): Filter data based on conditions
- ntile(): Create distribution tiles/quantiles
Text Analysis Functions
Section titled “Text Analysis Functions”- extract(): Extract specific information from text
- classify(): Classify text into categories
- score(): Create sentiment scores between two poles
- word_count(): Count words in text columns
Advanced Filter Patterns
Section titled “Advanced Filter Patterns”Numeric Comparisons
Section titled “Numeric Comparisons”filter(revenue >= 1000)filter(age > 25 and age < 65)filter(score != 0)filter(rating == 5)String Comparisons
Section titled “String Comparisons”filter(customer_type is "premium")filter(status is not "cancelled")filter(product_name like "iPhone")filter(description not like "old")filter(email != "")Sequence Matching
Section titled “Sequence Matching”filter(region in ("US", "Canada", "Mexico"))filter(status not in ("cancelled", "refunded"))filter(category in (1, 2, 3, 4))Temporal Filtering
Section titled “Temporal Filtering”filter(order_date after "2024-01-01")filter(created_at before "2024-12-31")filter(delivery_date between "2024-01-01" and "2024-03-31")Complex Boolean Logic
Section titled “Complex Boolean Logic”filter(revenue > 1000 and customer_type is "premium")filter(status is "active" or last_login after "2024-01-01")filter(age >= 18 and (country is "US" or country is "CA"))Text Analysis Functions
Section titled “Text Analysis Functions”Extract Information
Section titled “Extract Information”extract("email addresses" from customer_notes)extract("product names" from review_text)extract("dollar amounts" from transaction_descriptions)Classify Text
Section titled “Classify Text”classify(feedback_text into ( "positive": "happy, satisfied, great experience", "negative": "frustrated, disappointed, poor service", "neutral": "factual, informational, no strong emotion"))
classify(support_tickets into ( "billing", "technical", "feature_request", "complaint"))Score Sentiment
Section titled “Score Sentiment”score(review_text from "terrible" to "amazing")score(employee_feedback from "dissatisfied" to "highly_engaged")score(product_reviews from "hate" to "love")Count Words
Section titled “Count Words”word_count(product_description)word_count(customer_comments)Data Distribution
Section titled “Data Distribution”Create Quantiles
Section titled “Create Quantiles”ntile(revenue, 4) // Create quartilesntile(age, 10) // Create decilesntile(score, 100) // Create percentilesChaining Functions
Section titled “Chaining Functions”Functions can be chained using the -> operator:
filter(customer_type is "premium") ->extract("product mentions" from feedback_text)
filter(revenue > 10000) ->score(satisfaction_survey from "very_dissatisfied" to "very_satisfied")
filter(order_date after "2024-01-01") ->classify(support_tickets into ("billing", "technical", "shipping"))Advanced Pattern Examples
Section titled “Advanced Pattern Examples”Customer Segmentation Analysis
Section titled “Customer Segmentation Analysis”// High-value customers with recent activityfilter(lifetime_value > 5000 and last_purchase after "2024-01-01")
// Premium customers with complaintsfilter(tier is "premium") ->classify(feedback into ("complaint", "praise", "suggestion", "question"))Product Analysis
Section titled “Product Analysis”// Recent product reviewsfilter(review_date after "2024-06-01") ->score(review_text from "disappointed" to "delighted")
// Extract features mentioned in feedbackfilter(product_category in ("electronics", "software")) ->extract("specific features mentioned" from customer_feedback)Time-Based Analysis
Section titled “Time-Based Analysis”// Weekend vs weekday analysisfilter(order_date between "2024-01-01" and "2024-12-31") ->ntile(order_total, 5)
// Seasonal pattern analysisfilter(created_at between "2024-12-01" and "2024-12-31") ->extract("holiday mentions" from customer_messages)Syntax Rules
Section titled “Syntax Rules”Identifiers
Section titled “Identifiers”- Column names:
customer_id,order_date,revenue - Special identifier:
$(refers to current dataset)
Literals
Section titled “Literals”- Strings: Must be quoted with double quotes
"premium" - Numbers: Support integers and decimals
1000,99.99,-5 - Dates: ISO format
"2024-01-01"or with time"2024-01-01T10:30:00" - Booleans:
true,false(case insensitive) - Null:
null
Operators
Section titled “Operators”- Comparison:
>,<,>=,<=,==,!= - String:
is,is not,like,not like - Set:
in,not in,contains - Temporal:
before,after,between - Boolean:
and,or - Chaining:
->(connects function outputs)
Parentheses and Grouping
Section titled “Parentheses and Grouping”- Function parameters:
filter(condition) - Boolean grouping:
(condition1 or condition2) and condition3 - Lists:
("value1", "value2", "value3")
Error Handling
Section titled “Error Handling”Common syntax errors to avoid:
// ❌ Incorrect - missing quotes around stringsfilter(status is premium)
// ✅ Correct - strings must be quotedfilter(status is "premium")
// ❌ Incorrect - wrong date formatfilter(date after "01/01/2024")
// ✅ Correct - use ISO date formatfilter(date after "2024-01-01")
// ❌ Incorrect - missing parenthesesfilter revenue > 1000
// ✅ Correct - function calls need parenthesesfilter(revenue > 1000)What’s Next?
Section titled “What’s Next?”Spreadsheet Interface
Learn how to use PXL within the spreadsheet interface for interactive data transformation.