Skip to content

Commit 93d33ec

Browse files
authored
Merge pull request #126 from ipums/document_concat_two_cols
Document column_mappings transform concat_two_cols
2 parents c0f0619 + 852155e commit 93d33ec

File tree

5 files changed

+58
-1
lines changed

5 files changed

+58
-1
lines changed

docs/_sources/column_mapping_transforms.md.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,25 @@ Maps string → string.
6161
transforms = [{type = "concat_to_b", value = " "}]
6262
```
6363

64+
## concat_two_cols
65+
66+
Concatenate the values from two columns together as strings. This transform takes
67+
a `column_to_append` attribute, which specifies the name of the column to concatenate
68+
to the end of the mapped column. To concatenate more than two columns, you can
69+
use this transform multiple times in a row.
70+
71+
If either of the columns are numerical, they are automatically converted to strings
72+
before the concatenation.
73+
74+
Maps (string | numerical) → string.
75+
76+
```toml
77+
# Concatenate two columns to the end of the mapped column.
78+
transforms = [
79+
{type = "concat_two_cols", column_to_append = "statefip"},
80+
{type = "concat_two_cols", column_to_append = "county"},
81+
]
82+
```
6483

6584
## lowercase_strip
6685

docs/column_mapping_transforms.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,23 @@ <h2>concat_to_b<a class="headerlink" href="#concat-to-b" title="Link to this hea
8282
</pre></div>
8383
</div>
8484
</section>
85+
<section id="concat-two-cols">
86+
<h2>concat_two_cols<a class="headerlink" href="#concat-two-cols" title="Link to this heading"></a></h2>
87+
<p>Concatenate the values from two columns together as strings. This transform takes
88+
a <code class="docutils literal notranslate"><span class="pre">column_to_append</span></code> attribute, which specifies the name of the column to concatenate
89+
to the end of the mapped column. To concatenate more than two columns, you can
90+
use this transform multiple times in a row.</p>
91+
<p>If either of the columns are numerical, they are automatically converted to strings
92+
before the concatenation.</p>
93+
<p>Maps (string | numerical) → string.</p>
94+
<div class="highlight-toml notranslate"><div class="highlight"><pre><span></span><span class="c1"># Concatenate two columns to the end of the mapped column.</span>
95+
<span class="n">transforms</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span>
96+
<span class="w"> </span><span class="p">{</span><span class="n">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;concat_two_cols&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">column_to_append</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;statefip&quot;</span><span class="p">},</span>
97+
<span class="w"> </span><span class="p">{</span><span class="n">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;concat_two_cols&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">column_to_append</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;county&quot;</span><span class="p">},</span>
98+
<span class="p">]</span>
99+
</pre></div>
100+
</div>
101+
</section>
85102
<section id="lowercase-strip">
86103
<h2>lowercase_strip<a class="headerlink" href="#lowercase-strip" title="Link to this heading"></a></h2>
87104
<p>Used in name cleaning. Convert alphabetical characters to lower-case and strip white
@@ -325,6 +342,7 @@ <h3>Navigation</h3>
325342
<li class="toctree-l2"><a class="reference internal" href="#add-to-a">add_to_a</a></li>
326343
<li class="toctree-l2"><a class="reference internal" href="#concat-to-a">concat_to_a</a></li>
327344
<li class="toctree-l2"><a class="reference internal" href="#concat-to-b">concat_to_b</a></li>
345+
<li class="toctree-l2"><a class="reference internal" href="#concat-two-cols">concat_two_cols</a></li>
328346
<li class="toctree-l2"><a class="reference internal" href="#lowercase-strip">lowercase_strip</a></li>
329347
<li class="toctree-l2"><a class="reference internal" href="#rationalize-name-words">rationalize_name_words</a></li>
330348
<li class="toctree-l2"><a class="reference internal" href="#remove-qmark-hyphen">remove_qmark_hyphen</a></li>

docs/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ <h1>Configuration API<a class="headerlink" href="#configuration-api" title="Link
9494
<li class="toctree-l2"><a class="reference internal" href="column_mapping_transforms.html#add-to-a">add_to_a</a></li>
9595
<li class="toctree-l2"><a class="reference internal" href="column_mapping_transforms.html#concat-to-a">concat_to_a</a></li>
9696
<li class="toctree-l2"><a class="reference internal" href="column_mapping_transforms.html#concat-to-b">concat_to_b</a></li>
97+
<li class="toctree-l2"><a class="reference internal" href="column_mapping_transforms.html#concat-two-cols">concat_two_cols</a></li>
9798
<li class="toctree-l2"><a class="reference internal" href="column_mapping_transforms.html#lowercase-strip">lowercase_strip</a></li>
9899
<li class="toctree-l2"><a class="reference internal" href="column_mapping_transforms.html#rationalize-name-words">rationalize_name_words</a></li>
99100
<li class="toctree-l2"><a class="reference internal" href="column_mapping_transforms.html#remove-qmark-hyphen">remove_qmark_hyphen</a></li>

docs/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sphinx-docs/column_mapping_transforms.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,25 @@ Maps string → string.
6161
transforms = [{type = "concat_to_b", value = " "}]
6262
```
6363

64+
## concat_two_cols
65+
66+
Concatenate the values from two columns together as strings. This transform takes
67+
a `column_to_append` attribute, which specifies the name of the column to concatenate
68+
to the end of the mapped column. To concatenate more than two columns, you can
69+
use this transform multiple times in a row.
70+
71+
If either of the columns are numerical, they are automatically converted to strings
72+
before the concatenation.
73+
74+
Maps (string | numerical) → string.
75+
76+
```toml
77+
# Concatenate two columns to the end of the mapped column.
78+
transforms = [
79+
{type = "concat_two_cols", column_to_append = "statefip"},
80+
{type = "concat_two_cols", column_to_append = "county"},
81+
]
82+
```
6483

6584
## lowercase_strip
6685

0 commit comments

Comments
 (0)