相关文章推荐
小百科
›
Clean and Shape Data in Tableau Prep - Tableau
tableau
幸福的骆驼
3 月前
</noscript><div id="app" class="wrapper"><header id="tableau-help-article-header" class="container--full-width quick-help-header"><div class="container--centered"><div class="header__mobile-menu quick-help-hidden"><menu-tree-toggle/></div><div class="header__logo quick-help-hidden"><a id="tableau-logo" href="https://www.tableau.com/en-us/"><img src="./Resources/tableau-logo.png" class="header__logo__img" alt="Tableau"/></a></div><div class="header__search"><search-header-help placeholder="Search"/></div></div></header><div class="container--navigation-top quick-help-hidden content-only-hidden"><div id="help-subheader" class="subheader print-hidden"><div class="container--centered"><h1 class="heading--subheader">Tableau Prep Help</h1></div></div><div class="container--top-links"><div class="container--centered container--breadcrumbs"><div><breadcrumb-links-help/></div></div><div id="help-container-menu-headings" class="container--menu-headings"><nav class="nav-medium-screen"><menu-heading-links-static-help menu-title="In this article" :disabled="false" :headings="pageHeadings"/></nav></div></div></div><div class="section--main container--full-width"><div class="container--centered"><nav class="nav-side nav-side--left" role="navigation"><menu-tree-help menu-title="Contents"/></nav><article role="main"><h2 class="topic--title" id="topic-title" tabindex="-1">Clean and Shape Data</h2><div class="caption article__tags content-only-hidden quick-help-hidden"><span class="article__tags--applies-to"> </span><br/><span class="article__tags--role"> </span></div><div id="content-body"> <p class="note"><b>Note</b>: Starting in version 2020.4.1, you can now create and edit flows in <span class="mc-variable Variables.TabsProductServer variable">Tableau Server</span> and <span class="mc-variable Variables.TabsProductOnline variable">Tableau Cloud</span>. The content in this topic applies to all platforms, unless specifically noted. For more information about authoring flows on the web, see <b>Tableau Prep on the Web</b> in the <a href="https://help.tableau.com/current/server/en-us/prep_web_auth.htm" target="_blank">Tableau Server<span class="sr-only">(Link opens in a new window)</span></a> and <a href="https://help.tableau.com/current/online/en-us/prep_web_auth.htm" target="_blank">Tableau Cloud<span class="sr-only">(Link opens in a new window)</span></a> help.</p> <p>Tableau Prep offers various cleaning operations that you can use to clean and shape your data. Cleaning up dirty data makes it easier to combine and analyze your data or makes it easier for others to understand your data when sharing your data sets.</p> <p>You can also clean your data using a pivot step or a script step to apply R or Python scripts to your flow. Script steps aren’t supported in Tableau Cloud. For more information, see <a href="prep_pivot.htm" target="_blank" class="MCXref xref">Pivot Your Data<span class="sr-only">(Link opens in a new window)</span></a> or <a href="prep_scripts.htm" target="_blank" class="MCXref xref">Use R and Python scripts in your flow<span class="sr-only">(Link opens in a new window)</span></a>.</p> <h2 is="heading-item" :level="2" id="about-cleaning-operations"><a name="Edit"/>About cleaning operations</h2> <p>You clean data by applying cleaning operations such as filtering, adding, renaming, splitting, grouping, or removing fields. You can perform cleaning operations in most step types in your flow. You can also perform cleaning operations in the data grid in a cleaning step.</p> <p>You can apply limited cleaning operations in the Input step and can't apply cleaning operations in the output step. For more information about applying cleaning operations in the Input step, see <a href="prep_configure_dastaset.htm#clean_input" target="_blank" class="MCXref xref">Apply cleaning operations in an input step<span class="sr-only">(Link opens in a new window)</span></a>.</p> <h3 is="heading-item" :level="3" id="available-cleaning-operations"> Available cleaning operations</h3> <p>The following table shows which cleaning operations are available in each step type:</p> <p>As you make changes to your data, annotations are added to the corresponding step in the <span class="uicontrol">Flow</span> pane and an entry is added in the <span class="uicontrol">Changes</span> pane to track your actions. If you make changes in the Input step, the annotation shows to the left of the step in the <span class="uicontrol">Flow</span> pane and shows in the <span class="uicontrol">Input profile</span> in the field list. </p> <p>The order that you apply your changes matters. Changes made in Aggregate, Pivot, Join, and Union step types are performed either before or after those cleaning actions, depending on where the field is when you make the change. Where the change was made is shown in the <span class="uicontrol">Changes</span> pane for the step.</p> <p>The following example shows changes made to several fields in a Join step. The change is performed before the join action to give the corrected results.</p> <h3 is="heading-item" :level="3" id="order-of-operations">Order of operations</h3> <p>The following table shows where the cleaning action is performed in Aggregate, Pivot, Join, and Union step types depending on where the field is in the step.</p> <p class="note"><b>Note</b>: For joins, if the field is a calculated field that was created using a field from one table, the change is applied before the join. If the field is created with fields from both tables, the change is applied after the join. </p> <h2 is="heading-item" :level="2" id="apply-cleaning-operations"><a name="clean_steps"/>Apply cleaning operations </h2> <p>To apply cleaning operations to fields, use the toolbar options or click <span class="uicontrol">More options</span> <img src="Img/prep_moreoptions_icon.png" alt=""/> on the field profile card, data grid, or Results pane to open the menu.</p> <p>In Aggregate, Pivot, Join, and Union step types, the <span class="uicontrol">More options</span> <img src="Img/prep_moreoptions_icon.png" alt=""/>menu is available on the profile cards in the Results pane and corresponding data grid. If you perform the same cleaning operations or actions over and over throughout your flow, you can copy and paste your steps, actions, or even fields. For more information see <a href="prep_copy_reuse_steps.htm" class="MCXref xref">Copy steps, actions and fields</a>.</p> <h3 is="heading-item" :level="3" id="select-your-view"><a name="select_view"/>Select your view</h3> <p>You can perform cleaning operations outside of the profile or results pane in the data grid or in the list view. Use the view toolbar <img src="Img/prep_view_toolbar.png" alt=""/> (<span class="mc-variable Variables.TabsProductPrepBuilder variable">Tableau Prep Builder</span> version 2019.3.2 and later and on the web) to change your view, then click <span class="uicontrol">More options</span><img src="Img/prep_moreoptions_icon.png" alt=""/> on a field to open the cleaning menu. </p> <p><span class="uicontrol">Show profile pane</span>: <img src="Img/prep_show_profile_pane.png" alt=""/> This is the default view. Select this button to go back to the Profile pane or Results pane view.</p> <p><span class="uicontrol">Show data grid</span>: <img src="Img/prep_show_datagrid.png" alt=""/> Collapse the profile or results pane to expand and show only the data grid. This view provides a more detailed view of your data and can be useful when you need to work with specific field values. After you select this option, this view state persists across all steps in your flow but you can change it at any time.</p> <p class="note"><b>Note</b>: Not all cleaning operations are available in the data grid. For example if you want to edit a value in-line, you must use the Profile pane.</p> <p><span class="uicontrol">Show list view</span> <img src="Img/prep_show_list.png" alt=""/> (<span class="mc-variable Variables.TabsProductPrepBuilder variable">Tableau Prep Builder</span> version 2019.3.2 and later and on the web): Convert the profile pane or results pane into a list. After you select this option, this view state persists across all steps in your flow but you can change it at any time.</p> <p>In this view you can:</p> <li>Select and remove multiple rows using the <span class="uicontrol">X</span> option.</li> <li>(version 2021.1.4 and later) Select and hide or unhide multiple rows using the <img src="Img/prep_hide_fields_icon.png" alt=""/>option.</li> <li>(version 2021.2.1 and later) Rename fields in bulk.</li> <p>Use the <span class="uicontrol">More options</span><img src="Img/prep_moreoptions_icon.png" alt=""/> menu to apply operations to selected fields.</p> <p>If you assign a data role to the field, or select <span class="uicontrol">Filter</span>, <span class="uicontrol">Group Values</span>, <span class="uicontrol">Clean</span>, or <span class="uicontrol">Split Values</span>, you're returned to the Profile or Results view to complete those actions. All other options can be performed in the list view.</p> <div is="accordion-item"><span slot="title">Tableau Prep Builder version 2019.3.1 and earlier</span><div slot="content"> <p> Use the view toolbar <img src="Img/prep_view_toolbar_2019_3.png" alt=""/> to hide the Profile pane and show only the data grid. Then click <span class="uicontrol">More options</span><img src="Img/prep_moreoptions_icon.png" alt=""/> on a field in the data grid to open the cleaning menu. This view shows a more detailed view of your data and can be useful when you need to work with specific field values. After you select this option, this view state persists across all steps in your flow but you can change it at any time.</p> <p class="note"><b>Note</b>: Not all cleaning operations are available in the data grid. For example if you want to edit a value in-line, you must use the Profile pane.</p> </div><h3 is="heading-item" :level="3" id="pause-data-updates-to-boost-performance"><a name="play_pause_updates"/>Pause data updates to boost performance</h3> <p>As you perform cleaning operations on your data, Tableau Prep applies your changes as you go to show you the results immediately. To save valuable processing time when you know the changes you need to make and don't need immediate feedback as you make each change, you can boost performance by pausing data updates.</p> <p>When you pause data updates, you can make all your changes at once, then resume updates to see your results. You can resume data updates and enable all available operations at any time.</p> <p class="note"><b>Note</b>: When you pause data updates, any operations that require you to see your values are disabled. For example if you want to apply a filter to selected values, you need to see the values you want to exclude. </p> <p>In the top menu, click <span class="uicontrol">Pause data updates </span>to pause updates.</p> <p>Tableau Prep converts the Profile pane into the List view. In List view, use the <span class="uicontrol">More options</span><img src="Img/prep_moreoptions_icon.png" alt=""/> menu to apply operations to selected fields. If the operation requires you to see your values, it is disabled. To enable the operation, you must resume data updates.</p> <p>For more information about using List view mode, see <a href="#select_view" class="MCXref xref">Select your view</a>.</p> <p>To see the results of your changes or enable a disabled feature, resume data updates. Click the <span class="uicontrol">Resume data updates</span> button, click the <span class="uicontrol">Resume</span> button in the menu dialog or in the message banner at the top of the Flow pane.</p> <p class="note"><b>Note</b>: <span class="mc-variable Variables.TabsProductPrepBuilder variable">Tableau Prep Builder</span> gives you an option to resume updates directly from the menu. If editing flows on the web, you'll need to resume updates from the top menu.</p> <h3 is="heading-item" :level="3" id="apply-cleaning-operations1"><a name="clean_list"/>Apply cleaning operations</h3> <p>To apply cleaning operations to a field, do the following:</p> <p class="note"><b>Note</b>: You can perform cleaning operations in a list view beginning in <span class="mc-variable Variables.TabsProductPrepBuilder variable">Tableau Prep Builder</span> version 2019.3.2 and on Tableau Server and <span class="mc-variable Variables.TabsProductOnline variable">Tableau Cloud</span> starting in version 2020.4.</p> <p>In the <span class="uicontrol">Profile</span> pane, data grid, Results pane, or list view, select the field you want to make changes to. </p> <p>From either the toolbar or <span class="uicontrol">More options</span> <img src="Img/prep_moreoptions_icon.png" alt=""/> menu for the field , select from the following options:</p> <p><span class="uicontrol">Filter</span> or <span class="uicontrol">Filter Values</span>: Select from one of the filter options, right-click or Ctrl-click (MacOS) a field value to keep or exclude values. You can also use the <span class="uicontrol">Selected Values</span> filter to pick and choose the values to filter, included values not in your flow sample. For more information about filter options, see <a href="prep_filter.htm" target="_blank" class="MCXref xref">Filter Your Data<span class="sr-only">(Link opens in a new window)</span></a>.</p> <p><span class="uicontrol">Group Values</span> (<span class="uicontrol">Group and Replace</span> in prior versions): Manually select values or use automatic grouping. You can also multi-select values in the Profile card and right-click or Ctrl-click (MacOS) to group or ungroup values or edit the group value. For more information about using <span class="uicontrol">Group Values</span>, see <a href="#fuzzy_match" class="MCXref xref">Automatically map values to a standard value using fuzzy match <p><span class="uicontrol">Clean</span>: Select from a list of quick cleaning operations to apply to all values in the field.</p> <p><span class="uicontrol">Convert Dates</span> (<span class="mc-variable Variables.TabsProductPrepBuilder variable">Tableau Prep Builder</span> version 2020.1.4 and later and on the web): For fields assigned to a Date or Date & Time data type, select from a list of DATEPART quick cleaning operations to convert your date field values to an integer value representing year, quarter, month, week, day, or a date and time value.</p> <p>Starting in version 2021.1.4, you can also select from two DATENAME quick cleaning operations, day of the week or month name, to convert your date field values.</p> <p><span class="uicontrol">Custom Fiscal Year </span>(<span class="mc-variable Variables.TabsProductPrepBuilder variable">Tableau Prep Builder</span> version 2020.3.3 and later and on the web): If your fiscal year doesn't start in January, you can set a custom fiscal month to convert the date using that month instead of the default month of January.</p> <p>This setting is on a per field basis, so if you want to apply a custom fiscal year to other fields, repeat this same step.</p> <p>To open the dialog, from the <span class="uicontrol">More options</span><img src="Img/prep_moreoptions_icon.png" alt=""/> menu, select <span class="uicontrol">Convert Dates </span>> <span class="uicontrol">Custom Fiscal Year</span>.</p> <p><span class="uicontrol">Split Values</span>: Split values automatically based on a common separator or use custom split to specify how you want to split field values.</p> <p>Automatic split and custom split work the same as they do in Tableau Desktop. For more information, see <span class="Hyperlink"><a href="https://help.tableau.com/current/pro/desktop/en-us/split.htm" target="_blank">Split a Field into Multiple Fields<span class="sr-only">(Link opens in a new window)</span></a></span> in the Tableau Desktop and Web Authoring Help.</p> <p><span class="uicontrol">Rename Field</span>: Edit the field name.</p> <p><span class="uicontrol">Duplicate Field</span> (<span class="mc-variable Variables.TabsProductPrepBuilder variable">Tableau Prep Builder</span> version 2019.2.3 and later and on the web): Create a copy of your field and values.</p> <p><span class="uicontrol">Keep Only Field</span>(<span class="mc-variable Variables.TabsProductPrepBuilder variable">Tableau Prep Builder</span> version 2019.2.2 and later and on the web): Keep only the selected field and exclude all other fields in the step.</p> <p><span class="uicontrol">Create Calculated Field</span>: Write a custom calculation in the Calculation editor or use the Visual Calculation editor (Tableau Prep Builder version 2020.1.1 and later and on the web) to create level of detail, rank or row number calculations. For more information, see <a href="prep_calculations.htm" class="MCXref xref">Create Level of Detail, Rank, and Tile Calculations </a>.</p> <li><span class="uicontrol">Publish as Data Role</span>: Create custom data roles that you can then apply to your fields to validate the field values when cleaning data. For more information about this option, see <a href="prep_validate_data.htm#custom_data_roles" target="_blank" class="MCXref xref">Create custom data roles <span class="sr-only">(Link opens in a new window)</span></a>.</li> <li><span class="uicontrol">Hide Field</span>: If you have fields you want to keep in your flow but don't need to clean, you can hide them out of the way instead of removing them. For more information, see <a href="prep_filter.htm#hide_fields" class="MCXref xref">Hide fields</a>. </li> <p><span class="uicontrol">Remove</span> (<span class="uicontrol">Remove Field</span> in previous versions): Remove the field from the flow.</p> <p>To edit a value, right-click or Ctrl-click (MacOS) one or more values and select <span class="uicontrol">Edit Value</span> then enter a new value. You can also select <span class="uicontrol">Replace with Null</span> to replace the values with a Null value or double-click in a single field to edit it directly. For more information about editing field values see <a href="#editvalues" class="MCXref xref">Edit field values</a>.</p> <li value="4">Review the results of these operations in the <span class="uicontrol">Profile</span> pane, Summary panes or data grid.</li> <h3 is="heading-item" :level="3" id="rename-fields-in-bulk"><a name="bulk_rename_fields"/>Rename fields in bulk</h3> <p><i>Supported in Tableau Prep Builder version 2021.2.1 and later. Supported in Tableau Prep on the web in Tableau Server and Tableau Cloud version 2021.2 and later.</i> <p>Use the <span class="uicontrol">Rename Fields</span> option to rename multiple fields in bulk. Search for parts of a field name to replace or remove it, or add prefixes or suffixes to all or selected fields in your data set.</p> <p>You can also automatically apply the same change to any fields added in the future that match your criteria by selecting the <span class="uicontrol">Automatically rename new fields</span> check box when making your changes.</p> <p class="note"><b>Note</b>: This option is only available in a <span class="uicontrol">Clean</span> step type.</p> <p>In a <span class="uicontrol">Clean</span> step, from the toolbar, select <span class="uicontrol">Rename Fields</span>.</p> <p>Your view is automatically converted to the <span class="uicontrol">List view</span> showing all the fields in your flow. You can use the <span class="uicontrol">Search</span> option in the toolbar to narrow your results. </p> <p> All fields are selected by default. Clear the top check box to clear the selection for all fields to manually select only the fields you want to change.</p> <li value="2">In the <span class="uicontrol">Rename Fields</span> pane, select from the following options:<ul><li><p><span class="uicontrol">Replace text</span>: In the <span class="uicontrol">Find text</span> field, find matching text using the <span class="uicontrol">Search options</span>, then enter the replacement text in the <span class="uicontrol">Replace with</span> field. To find blank spaces, press the space bar in the <span class="uicontrol">Find text</span> field.</p><p class="note"><b>Note</b>: Renaming fields can't result in blank or duplicate field names. </p><p><img src="Img/prep_rename_fields_search_options.png" alt=""/></p></li><li><span class="uicontrol">Add prefix</span>: Add text to the beginning of all selected field names.</li><li><p><span class="uicontrol">Add suffix</span>: Add text to the end of all selected field names.</p><p>As you make your entries, your results display in the <span class="uicontrol">List view</span> pane.</p><p><img src="Img/prep_rename_fields_suffix.png" alt=""/></p></li></ul></li> <li value="3">(optional) Select <span class="uicontrol">Automatically rename new fields</span> to automatically apply these same changes to new fields that match your replacement criteria when your data is refreshed.</li> <p>Click <span class="uicontrol">Rename</span> to apply your changes and close the pane. The <span class="uicontrol">Rename</span> button shows the number of fields that are impacted by your changes.</p> <h2 is="heading-item" :level="2" id="view-your-changes"><a name="changes_pane"/>View your changes</h2> <p>The different types of cleaning operations are represented by icons over the steps in your flow. If more than four types of operations are applied to a step, an ellipsis displays over the step. Hover over these icons to view annotations showing applied operations and the order in which they are performed.</p> <p>Starting in <span class="mc-variable Variables.TabsProductPrepBuilder variable">Tableau Prep Builder</span> version 2019.1.3 and later and on the web, you can click on an annotation on the change icon on a step in the Flow pane or on a profile card in the Profile or Results pane and the change and field it impacts will be highlighted in the <span class="uicontrol">Changes</span> pane and the <span class="uicontrol">Profile</span> or<span class="uicontrol"> Results</span> pane.</p> <p>You can also select a step and then expand the <span class="uicontrol">Changes</span> pane to view the details for each change, edit or remove your changes, drag changes up or down to change the order in which they're applied and add a description to provide context to other users. For more information about adding descriptions to your changes, see <a href="prep_build_flow.htm#descriptions" target="_blank" class="MCXref xref">Add descriptions to flow steps and cleaning actions<span class="sr-only">(Link opens in a new window)</span></a>.</p> <h2 is="heading-item" :level="2" id="merge-fields"><a name="Merge"/>Merge fields</h2> <p>If you have fields that contain the same values but are named differently, you can easily merge them into a single field to combine them by dragging one field on top of the other. When you merge the fields, the target field becomes the primary field and the field name of the target field persists. The field that you merge to the target field is removed.</p> <p><b>Example:</b> <p>When you merge fields, Tableau Prep keeps all of the fields from the target field and replaces any nulls in that field with values from the source fields that you merge with the target field. The source fields are removed.</p> <p><b>Example</b> <p>Select multiple fields and right-click within the selection to open the context menu, and then click <span class="uicontrol">Merge Fields</span>.</p> <p>Select multiple fields, and then click <span class="uicontrol">Merge Fields</span> on the toolbar.</p> <p>For information about how to fix mismatched fields as a result of a union, see <a href="prep_combine.htm#Fix_union" class="MCXref xref">Fix fields that don’t match</a>.</p> <h2 is="heading-item" :level="2" id="apply-cleaning-operations-using-recommendations"><a name="recommendations"/>Apply cleaning operations using recommendations </h2> <p>Sometimes it can be hard to identify which cleaning operation you need to use to fix problems in your data. Tableau Prep can analyze your data and recommend cleaning operations that you can apply automatically to quickly fix problems in your data fields or help to identify problems so you can fix them. This feature is available in all step types except Input, Output and Join step types.</p> <p class="note"><b>Note</b>: In Tableau Prep Builder, if you don't want to use this feature, you can turn it off. From the top menu, go to <span class="uicontrol">Help</span> > <span class="uicontrol">Settings and Performance</span>. Then click on <span class="uicontrol">Enable Recommendations</span> to clear the check mark next to the setting.</p> <p>Recommendation types include:</p> <p>Data roles</p> <p>Filter</p> <li>Group values (also applies to fields with data roles starting in Tableau Prep Builder version 2019.2.3 and on the web)</li> <p>Pivot columns to rows (Tableau Prep Builder version 2019.4.2 and later and on the web)</p> <li>Replace values with Null values</li> <p>Remove fields</p> <p>Split (<span class="mc-variable Variables.TabsProductPrepBuilder variable">Tableau Prep Builder</span> version 2019.1.1 and later and on the web)</p> <p class="note"><b>Note</b>: This option works specifically with data in fixed-width type text files. To use the split recommendation with this file type, after you connect to the data source, in the Input step, in the <span class="uicontrol">Text Settings</span> tab, select a <span class="uicontrol">Field Separator</span> character that is not used in the data so the data loads as a single field.</p> <p>Trim spaces</p> <h3 is="heading-item" :level="3" id="apply-recommendations">Apply recommendations</h3> <p>Do one of the following:</p> <li>Click the light bulb <img src="Img/prep_suggestions_icon.png" alt=""/>icon in the top right corner of the profile card.</li> <li>From the toolbar, click the <span class="uicontrol">Recommendations</span> drop-down arrow to view all recommendations for your data set and select a recommendation from the list.</li> <p>This option only appears when recommended changes are identified by Tableau Prep.</p> <p>The change is automatically applied and an entry is added to the <span class="uicontrol">Changes</span> pane. To remove the change, click <span class="uicontrol">Undo</span> in the top menu or hover over the change in the <span class="uicontrol">Changes</span> pane and click the <span class="uicontrol">X</span> to remove it.</p> <p>If you apply a recommendation to pivot fields, a Pivot step is automatically created where you can then perform any additional pivot actions like renaming the pivoted fields or pivoting on additional fields.</p> <p>If Tableau Prep identifies further recommendations as a result of the change, the light bulb icon remains on the Profile card until no further recommendations are found.</p> <p> Repeat the steps above to apply any additional changes or ignore the suggested change and use the other cleaning tools to address the data problems.</p> <h2 is="heading-item" :level="2" id="edit-field-values"><a name="editvalues"/>Edit field values</h2> <p>Multiple variations of the same value can prevent you from accurately summarizing your data. You can quickly and easily correct these variations using the following options. </p> <p class="note"><b>Note</b>: Any edits that you make to the values must be compatible with the field data type. </p> <h3 is="heading-item" :level="3" id="edit-a-single-value">Edit a single value</h3> <p>In the <span class="uicontrol">Profile</span> card, click the value you want to edit, and enter the new value. A group icon <img src="Img/prep_groupicon.png" alt=""/> shows next to the value.</p> <p>Alternatively, right-click a value and click <span class="uicontrol">Edit Value</span>. The change is recorded in the <span class="uicontrol">Changes</span> pane on the left side of the screen.</p> <h3 is="heading-item" :level="3" id="edit-multiple-values">Edit multiple values</h3> <p>You have several options to edit multiple values at once. For example, use quick cleaning operations to remove punctuation for all values in a field, manually group values using multi-select, automatically group values together using fuzzy-match algorithms that find similar values or select multiple values and replace them with Null.</p> <p class="note"><b>Note</b>: When you map multiple values to a single value, the original field shows a group icon <img src="Img/prep_groupicon.png" alt=""/> next to the value, showing you which values are grouped together. </p> <h4>Edit multiple values using quick cleaning operations <p>This option applies only to text fields. </p> <p>In the <span class="uicontrol">Profile </span>pane, Results pane or data grid, select the field you want to edit. </p> <p>Click <span class="uicontrol">More options</span><img src="Img/prep_moreoptions_icon.png" alt=""/>, select <span class="uicontrol">Clean</span>, and then select one of the following options:</p> <p><span class="uicontrol">Make Uppercase</span>: Change all values to uppercase text.</p> <p><span class="uicontrol">Make Lowercase</span>: Change all values to lowercase text.</p> <p><span class="uicontrol">Make Titlecase</span>: Change all values to title case text.</p> <p><span class="uicontrol">Remove Letters</span>: Remove all letters and leave only other characters.</p> <p><span class="uicontrol">Remove Numbers</span>: Remove all numbers and leave letters and other characters.</p> <p><span class="uicontrol">Remove Punctuation</span>: Remove all punctuation.</p> <p><span class="uicontrol">Trim Spaces</span>: Remove leading and trailing spaces.</p> <li><span class="uicontrol">Remove Extra Spaces</span>: Remove leading and trailing whitespace and replace extra whitespace in-between characters with a single space.</li> <li><span class="uicontrol">Remove All Spaces</span>: Remove all whitespace, including leading and trailing whitespace and any whitespace in between characters.</li> <p>You can stack operations to apply multiple cleaning operations to the fields. For example first select <span class="uicontrol">Clean</span> > <span class="uicontrol">Remove Numbers</span> and then select <span class="uicontrol">Clean</span> > <span class="uicontrol">Remove Punctuation</span> to remove all numbers and punctuation from the field values.</p> <p>To undo your changes, click the <span class="uicontrol">Undo</span> arrow at the top of the <span class="uicontrol">Flow </span>pane, or remove the change from the change list.</p> <h4>Group and edit multiple values inline</h4> <p>Use this option to manually select multiple values and group them under a standard value in the profile card. To use other methods to group values, see <a href="#group_replace_manual" class="MCXref xref">Manually map multiple values to a standard value</a> and <a href="#fuzzy_match" class="MCXref xref">Automatically map values to a standard value using fuzzy match <p>In the <span class="uicontrol">Profile </span>card, select the field you want to edit.</p> <p>Press Ctrl or Shift+click or Command or Shift+click (MacOS), and select the values that you want to group.</p> <p> Right-click, and select <span class="uicontrol">Group</span> from the context menu. The value in the selection that you right-click becomes the default name for the new group but you can edit this in-line.</p> <p>To edit the group name, select the grouped field and edit the value or right-click or Ctrl+click (Mac) on the grouped field and select <span class="uicontrol">Edit Value</span> from the context menu.</p> <p>To ungroup the grouped field values, right-click on the grouped field and select <span class="uicontrol">Ungroup</span> from the context menu.</p> <h4>Replace one or more values with Null</h4> <p>If you have data rows that you want to include in your analysis but you want to exclude certain field values you can change them to a Null value.</p> <p>In the <span class="uicontrol">Profile </span>card, press Ctrl or Shift+click or Command or Shift+click (on Mac), and select the values that you want to change</p> <p> Right-click or Ctrl+click (Mac), and select <span class="uicontrol">Repace with Null</span> from the menu. The values are changed to Null and the group icon <img src="Img/prep_groupicon.png" alt=""/> shows next to the value.</p> <h2 is="heading-item" :level="2" id="manually-map-multiple-values-to-a-standard-value"><a name="group_replace_manual"/>Manually map multiple values to a standard value</h2> <p>Use <span class="uicontrol">Group Values</span> (<span class="uicontrol">Group and Replace</span> in previous versions) to map the value of a field from one value to another or manually select multiple values to group them. You can even add new values to set up mapping relationships to organize your data.</p> <p>For example, let’s say you have three values in a field: My Company, My Company Incorporated, and My Company Inc. All these values represent the same company, My Company. You can use <span class="uicontrol">Group Values</span> to map the values My Company Incorporated and My Company Inc to My Company, so that all three values appear as My Company in the field.</p> <h3 is="heading-item" :level="3" id="map-multiple-values-to-a-single-selected-field">Map multiple values to a single selected field <p>In the <span class="uicontrol">Profile </span>pane or Results pane, select the field you want to edit.</p> <p>Click <span class="uicontrol">More options</span><img src="Img/prep_moreoptions_icon.png" alt=""/> and select <span class="uicontrol">Group Values</span> (<span class="uicontrol">Group and Replace</span> in previous versions) > <span class="uicontrol">Manual Selection</span> from the menu.</p> <p>In the left pane of the <span class="uicontrol">Group Values</span> editor, select the field value that you want to use as the grouping value. This value now shows at the top of the right pane.</p> <p>In the lower section of the right pane in the <span class="uicontrol">Group Values</span> editor, select the values you want to add to the group.</p> <p>To remove values from the group, in the upper section of the right pane in the <span class="uicontrol">Group Values</span> editor, clear the check box next to the values.</p> <h3 is="heading-item" :level="3" id="create-a-group-by-selecting-multiple-values">Create a group by selecting multiple values <p>In the <span class="uicontrol">Profile </span>pane or Results pane, select the field you want to edit.</p> <p>Click <span class="uicontrol">More options</span><img src="Img/prep_moreoptions_icon.png" alt=""/>and select <span class="uicontrol">Group Values</span> (<span class="uicontrol">Group and Replace</span> in previous versions) > <span class="uicontrol">Manual Selection</span> from the menu.</p> <p>In the left pane of the <span class="uicontrol">Group Values</span> editor, select multiple values that you want to group.</p> <p>In the right pane of the <span class="uicontrol">Group Values</span> editor, click <span class="uicontrol">Group Values</span>.</p> <p>A new group is created using the last selected value as the group name. To edit the group name, select the grouped field and edit the value or right-click or Ctrl+click (MacOS) on the grouped field and select <span class="uicontrol">Edit Value</span> from the menu.</p> <h3 is="heading-item" :level="3" id="add-and-identify-values-that-arent---in-the-data-set"><a name="out_sample"/>Add and identify values that aren't in the data set</h3> <p>If you want to map values in your data set to a new value that doesn't exist, you can add it using <span class="uicontrol">Group Values</span> (<span class="uicontrol">Group and Replace</span> in previous versions). To easily identify any values that are not in the data set, these values are marked with a red dot next to the value name in the <span class="uicontrol">Group Values</span> editor.</p> <p>For example in the image below, Wyoming and Nevada aren’t in the data set.</p> <p>Some reasons why a value might not be in the data set include the following:</p> <p>You just added the new value manually.</p> <p>The value is no longer in the data.</p> <p>The value is in the data, but isn’t in the sampled data set.</p> <p>To add a new value:</p> <p>In the <span class="uicontrol">Profile </span>pane or Results pane, select the field you want to edit.</p> <p>Click <span class="uicontrol">More options</span><img src="Img/prep_moreoptions_icon.png" alt=""/> and select <span class="uicontrol">Group Values</span> (<span class="uicontrol">Group and Replace</span> in previous versions) > <span class="uicontrol">Manual Selection</span> from the context menu.</p> <p>In the left pane of the <span class="uicontrol">Group Values</span> editor, click the plus <img src="Img/prep_addicon.png" alt=""/> to add a new value.</p> <p>Type a new value in the field and press Enter to add it.</p> <h2 is="heading-item" :level="2" id="automatically-map-values-to-a-standard-value-using-fuzzy-match"><a name="fuzzy_match"/>Automatically map values to a standard value using fuzzy match <p>To search for and automatically group similar values, use one of the fuzzy match algorithms. Field values are grouped under the value that appears most frequently. Review the grouped values and add or remove values in the group as needed. </p> <p>If you use data roles to validate your field values, you can use the <span class="uicontrol">Group Values</span> (<span class="uicontrol">Group and Replace</span> in previous versions) option to match invalid values with valid ones. For more information, see <a href="prep_validate_data.htm#Group_datarole" target="_blank" class="MCXref xref">Group similar values by data role <span class="sr-only">(Link opens in a new window)</span></a></p> <p>Choose one of the following options to group values:</p> <p><span class="uicontrol">Pronunciation</span>: Find and group values that sound alike. This option uses the Metaphone 3 algorithm that indexes words by their pronunciation and is most suitable for English words. This type of algorithm is used by many popular spell checkers. This option isn't available for data roles.</p> <p><span class="uicontrol">Common Characters</span>: Find and group values that have letters or numbers in common. This option uses the ngram fingerprint algorithm that indexes words by their unique characters after removing punctuation, duplicates, and whitespace. This algorithm works for any supported language. This option isn't available for data roles.</p> <p>For example, this algorithm would match names that are represented as "John Smith" and "Smith, John" because they both generate the key "hijmnost". Since this algorithm doesn't consider pronunciation, the value "Tom Jhinois" would have the same key "hijmnost" and would also be included in the group.</p> <p><span class="uicontrol">Spelling</span>: Find and group text values that are spelled alike. This option uses the Levenshtein distance algorithm to compute an edit distance between two text values using a fixed default threshold. It then groups them together when the edit distance is less than the threshold value. This algorithm works for any supported language.</p> <p>Starting in <span class="mc-variable Variables.TabsProductPrepBuilder variable">Tableau Prep Builder</span> version 2019.2.3 and on the web, this option is available to use after a data role is applied. In that case, it matches the invalid values to the closest valid value using the edit distance. If the standard value isn't in your data set sample, Tableau Prep adds it automatically and marks the value as not in the original data set.</p> <p><span class="uicontrol">Pronunciation +Spelling</span>: (<span class="mc-variable Variables.TabsProductPrepBuilder variable">Tableau Prep Builder</span> version 2019.1.4 and later and on the web) If you assign a data role to your fields, you can use that data role to match and group values with the standard value defined by your data role. This option then matches invalid values to the most similar valid value based on spelling and pronunciation. If the standard value isn't in your data set sample, Tableau Prep adds it automatically and marks the value as not in the original data set. This option is most suitable for English words.</p> <p>For more information see <a href="#Group_datarole" class="MCXref xref">Clean and Shape Data</a>. Want to read more about these fuzzy match algorithms? See <a href="https://www.tableau.com/blog/automated-grouping-tableau-prep-builder" target="_blank">Automated Grouping in Tableau Prep Builder<span class="sr-only">(Link opens in a new window)</span></a> on Tableau.com</p> <p class="note"><b>Note</b>: In <span class="mc-variable Variables.TabsProductPrepBuilder variable">Tableau Prep Builder</span> version 2019.1.4 and 2019.2.1 this option was labeled <span class="uicontrol">Data Role Matches</span>.</p> <h3 is="heading-item" :level="3" id="group-similar-values-using-fuzzy-match">Group similar values using fuzzy match</h3> <p>In the <span class="uicontrol">Profile </span>pane or Results pane, select the field you want to edit.</p> <p>Click <span class="uicontrol">More options</span><img src="Img/prep_moreoptions_icon.png" alt=""/>and select <span class="uicontrol">Group Values</span> then select one of these options:</p> <p><span class="uicontrol">Pronunciation</span> <p><span class="uicontrol">Common Characters</span> <p><span class="uicontrol">Spelling</span> <p>Tableau Prep Builder finds and groups values that match and replaces them with the value that occurs most frequently in the group.</p> <p>Review the groupings and manually add or remove values or edit them as needed. Then click <span class="uicontrol">Done</span>.</p> <h3 is="heading-item" :level="3" id="adjust-your-results-when-grouping-field-values">Adjust your results when grouping field values </h3> <p>If you group similar values by <span class="uicontrol">Spelling</span> or <span class="uicontrol">Pronunciation</span>, you can change your results by using the slider on the field to adjust how strict the grouping parameters are.</p> <p>Depending on how you set the slider, you can have more control over the number of values included in a group and the number of groups that get created. By default, Tableau Prep detects the optimal grouping setting and shows the slider in that position.</p> <p>When you change the threshold, Tableau Prep analyzes a sample of the values to determine the new grouping. The groups generated from the setting are saved and recorded in the <span class="uicontrol">Changes</span> pane, but the threshold setting isn't saved. The next time the <span class="uicontrol">Group Values</span> editor is opened, either from editing your existing change or making a new change, the threshold slider is shown in the default position, enabling you to make any adjustments based on your current data set.</p> <p>In the <span class="uicontrol">Profile </span>pane or <span class="uicontrol">Results</span> pane, select the field you want to edit.</p> <p>Click <span class="uicontrol">More options</span><img src="Img/prep_moreoptions_icon.png" alt=""/>and select <span class="uicontrol">Group Values</span> (<span class="uicontrol">Group and Replace</span> in previous versions) then select one of these options:</p> <p><span class="uicontrol">Pronunciation</span> <p><span class="uicontrol">Spelling</span> <p>Tableau Prep finds and groups values that match and replaces them with the value that occurs most frequently in the group.</p> <p>In the left pane of the <span class="uicontrol">Group Values</span> editor, drag the slider to one of the 5 threshold levels to change your results.</p>
推荐文章