Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add column with predefined values #10899

Closed
1 task done
rosmur opened this issue Feb 25, 2025 · 4 comments · Fixed by #10918
Closed
1 task done

docs: add column with predefined values #10899

rosmur opened this issue Feb 25, 2025 · 4 comments · Fixed by #10918
Assignees
Labels
docs Documentation related issues or PRs

Comments

@rosmur
Copy link

rosmur commented Feb 25, 2025

Please describe the issue

Lacking basic documentation on how to add a column with a predefined value. Eg: I want to add a new column with the values set at "this".

table.mutate(new_col="this") does not work.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@rosmur rosmur added the docs Documentation related issues or PRs label Feb 25, 2025
@cpcloud
Copy link
Member

cpcloud commented Feb 25, 2025

The way this is done is with ibis.literal:

In [5]: from ibis.interactive import *

In [6]: t = ibis.memtable({"col": [1, 2, 3]})

In [7]: t
Out[7]:
┏━━━━━━━┓
┃ col   ┃
┡━━━━━━━┩
│ int64 │
├───────┤
│     1 │
│     2 │
│     3 │
└───────┘

In [8]: t.mutate(new_col=ibis.literal("this"))
Out[8]:
┏━━━━━━━┳━━━━━━━━━┓
┃ col   ┃ new_col ┃
┡━━━━━━━╇━━━━━━━━━┩
│ int64 │ string  │
├───────┼─────────┤
│     1 │ this    │
│     2 │ this    │
│     3 │ this    │
└───────┴─────────┘

I thought we had some documentation around this in our getting started bits, but perhaps not!

@rosmur
Copy link
Author

rosmur commented Feb 25, 2025

Thanks, please add to docs!!

I want to use ibis but the documentation has completely ruined the onboarding and I'm finding I just slide back to Polars/pandas most times.

Even the LLMs give incorrect answers, likely as the documentation is lacking.

@romaingd
Copy link
Contributor

/take

@romaingd
Copy link
Contributor

romaingd commented Mar 4, 2025

Thanks for the issue @rosmur. A dedicated example was added to the Getting started docs, hopefully it correctly addresses your concern!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation related issues or PRs
Projects
Status: done
Development

Successfully merging a pull request may close this issue.

3 participants