Skip to content

Commit 6032e71

Browse files
docs: add introduction to pandas users for adding columns with single text values (literal) (ibis-project#11010)
## Description of changes ibis generally follows pandas syntax for mutating columns, with the exception of adding string columns where `ibis.literal` is needed. `ibis.literal` is not mentioned yet in the pandas' user introductions, so it would be helpful to include this as it's not clear to the user why adding a float column or summing two columns together uses the same syntax as pandas, while a adding a single-valued string column does not. This is the reason ibis-project#11009 was opened (as a q&a link to send to new users). Including it in the pandas introduction docs would reduce friction for switching to ibis for pandas users.
1 parent c0151f5 commit 6032e71

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/tutorials/coming-from/pandas.qmd

+6
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ mutated = t.mutate(two=t.two * 2)
234234
mutated
235235
```
236236

237+
To add a column with a single text value on all rows, you can use `ibis.literal`.
238+
239+
```{python}
240+
mutated = t.mutate(two_string=ibis.literal('two'))
241+
```
242+
237243
### Renaming columns
238244

239245
In addition to replacing columns, you can rename them as well. This is done with

0 commit comments

Comments
 (0)