forked from wireservice/csvkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
============================ | ||
Standardize names and values | ||
============================ | ||
|
||
Standardize row and columns names | ||
================================= | ||
|
||
The :meth:`Table.rename` method has arguments to convert row or column names to slugs and append unique identifiers to duplicate values. | ||
|
||
Using an existing table object: | ||
|
||
.. code-block:: python | ||
# Convert column names to unique slugs | ||
table.rename(slug_columns=True) | ||
# Convert row names to unique slugs | ||
table.rename(slug_rows=True) | ||
# Convert both column and row names to unique slugs | ||
table.rename(slug_columns=True, slug_rows=True) | ||
Standardize column values | ||
========================= | ||
|
||
agate has a :class:`Slug` computation that can be used to also standardize text column values. The computation has an option to also append unique identifiers to duplicate values. | ||
|
||
Using an existing table object: | ||
|
||
.. code-block:: python | ||
# Convert the values in column 'title' to slugs | ||
new_table = table.compute([ | ||
('title-slug', agate.Slug('title')) | ||
]) | ||
# Convert the values in column 'title' to unique slugs | ||
new_table = table.compute([ | ||
('title-slug', agate.Slug('title', ensure_unique=True)) | ||
]) |