HomeGuidesSDK ExamplesAnnouncementsCommunity
Guides

Dataframe Transformer

The DataFrame Transformer component allows you to modify and manipulate data frames using Pandas code within your skill flow. You can also use this component to merge multiple dataframes into one.

Basic Setup

  1. Add the DataFrameTransformer component from the node list
  2. Connect an existing DataFrame as input
  3. Access the Customize tab to implement your transformations

Writing Transformations

You can write Pandas code to modify your DataFrame in various ways. If you're not comfortable with coding, you can use AI assistance by providing:

  • Screenshots of inputs/outputs with Dataset names
  • Preview of the table output
  • Clear description of desired transformations
  • Sample of the base code shown in the customize tab

Best Practices

  • Test your transformations by running the skill up to the transformer node
  • Preview the transformed DataFrame in the outputs section
  • Chain multiple transformers for complex operations
  • Verify column names and data types in the preview

Example Transformations

Sales Analysis

# Sort by revenue and calculate monthly averages
df = df.sort_values('revenue', ascending=False)
df['monthly_average'] = df.groupby('month')['revenue'].transform('mean')

Data Cleanup

# Remove duplicates and handle missing values
df = df.drop_duplicates()
df = df.fillna({'price': 0, 'quantity': 0})
df['total'] = df['price'] * df['quantity']

Time Series Processing

# Convert dates and aggregate by time period
df['date'] = pd.to_datetime(df['date'])
df = df.resample('M', on='date').agg({
    'sales': 'sum',
    'customers': 'mean'
})

Complex Calculations

# Calculate performance metrics
df['profit_margin'] = (df['revenue'] - df['costs']) / df['revenue'] * 100
df['performance_score'] = df.groupby('department')['efficiency'].transform(
    lambda x: (x - x.mean()) / x.std()
)

Integration Options

  • Connect the transformed DataFrame to visualization components
  • Use as input for additional transformations
  • Include in skill responses

This component is particularly useful for data preprocessing, feature engineering, and preparing data for visualization or analysis.