Edit

Share via


How to use AI in Data Wrangler to enhance data preparation

Data Wrangler is an interactive interface in Fabric notebooks that helps you prepare data quickly and visually, with real-time previews before applying changes. It now includes several built-in AI capabilities for even faster data transformation, including AI functions, rule-based AI suggestions, and code generation with Copilot. For information on getting started with Data Wrangler, see Accelerate data prep with Data Wrangler.

Prerequisites

AI functions and Copilot in Data Wrangler

AI functions in Data Wrangler

To use AI functions in Data Wrangler, you will also need to install OpenAI in your notebook. The following code cell has the necessary installation commands:

# The pandas AI functions package requires OpenAI version 1.99.5 or later.
%pip install -q --force-reinstall openai==1.99.5 2>/dev/null

Apply AI Functions in Data Wrangler (preview)

Fabric AI functions allow you to perform tasks such as text summarization, classification, translation, sentiment analysis, grammar correction, your own prompt, and more, without writing complex code. To apply AI functions in Data Wrangler, open Data Wrangler, navigate to "Operations" on the left pane, expand 'AI enrichments', and select the function you would like to use.

Screenshot showing Data Wrangler and highlighting the 'Operations' and 'AI enrichments' sections.

After filling in the necessary details, select "Run Preview" to see a preview of the transformation on your data frame.

Screenshot highlighting the 'Categorize text' AI function and 'Run Preview' option.

To apply the changes to your data frame, select "Apply."

Screenshot highlighting the preview for the 'Categorize text' AI function and 'Apply' option.

Apply automated suggestions

Data Wrangler provides smart operation suggestions relevant to your data frame, leveraging rule-based AI from Microsoft PROSE. To view and apply these one-click suggestions, navigate to "Operations" on the left pane, expand “Suggestions,” and select the operation you would like to apply. A preview will be automatically generated. To keep the changes, select "Apply."

Screenshot highlighting the 'Suggestions' section with automated, relevant suggestions.

Generate code with Copilot

Copilot in Data Wrangler allows you to describe in plain language what you want to achieve and generates the corresponding transformation, along with an instant preview so you can validate the results before applying them. To use Copilot in Data Wrangler, select the Copilot text box above the code cell and describe your desired operation, such as “remove rows with missing values,” or “standardize dates to YYYY-MM-DD format.” Then, select "Run Preview." To apply the changes to your data frame, select "Apply."

Screenshot highlighting the 'Copilot' section describing a custom operation, and the code cell displaying the corresponding code.