Files
OpenBB/website/content/terminal/reference/econometrics/add.md
DidierRLopes 4ad995fdd0 Docs/terminalpro and improvement (#5622)
* add first iteration of content for Terminal Pro

* Update index.md

* Update dashboards.md

* Update folders.md

* Update grouping.md

* Update report.md

* Update templates.md

* Update quick-start.md

* Update index.md

* Update index.md

* Update home.md

* Update news.md

* Update index.md

* Update index.md

* Update index.md

* Update data-provider.md

* Update chat-with-widget.md

* Update data-manipulation.md

* Update forecasting.md

* fix: images self closing tags

* fix: only pro visitors can see pro

* inter font

* improve SEO content and restructuring

* add new package for toggle on tutorials

* move folder around

* improve main page of each prod

* small updates and improvements

* fix logo above

* small improvement in headtitle for portfolio funcs

* fix typos from OpenAI's GPT-4

* fix _category_ json

* remove generic SEO words

* add script that generates SEO for documentation

* add missing file

* remove sdk warning message

* fix links for andrew

---------

Co-authored-by: jose-donato <zmcdonato@gmail.com>
Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com>
Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com>
2023-10-30 21:01:29 +00:00

103 lines
14 KiB
Markdown
Vendored

---
title: add
description: This page provides documentation for the 'add' function in an Econometrics
software. This function allows you to add a new column to your dataset using various
computations on existing columns.
keywords:
- Econometrics
- Data manipulation
- Add function
- Computations
---
import HeadTitle from '@site/src/components/General/HeadTitle.tsx';
<HeadTitle title="econometrics /add - Reference | OpenBB Terminal Docs" />
Add columns to your dataframe with the option to use formulas. E.g. newdatasetcol = basedatasetcol sign criteriaordatasetcol thesis.high_revenue = thesis.revenue 1000 dataset.debt_ratio = dataset.debt div dataset2.assets
### Usage
```python
add -n NEWDATASETCOL -b BASEDATASETCOL -s {div,mul,add,sub,mod,pow,,,=,=,==} -c CRITERIAORDATASETCOL
```
---
## Parameters
| Name | Description | Default | Optional | Choices |
| ---- | ----------- | ------- | -------- | ------- |
| newdatasetcol | New dataset column to be added with format: dataset.column | None | False | None |
| basedatasetcol | Base dataset column to be used as base with format: dataset.column | None | False | None |
| sign | Sign to be applied to the base dataset column | None | False | div, mul, add, sub, mod, pow, , , =, =, == |
| criteriaordatasetcol | Either dataset column to be applied on top of base dataset or criteria | None | False | None |
---
## Examples
```python
2022 May 31, 04:50 (🦋) /econometrics/ $ load wage_panel -a wp
2022 May 31, 04:49 (🦋) /econometrics/ $ add -n wp.after_1990 -b wp.year -s -c 1990
2022 May 31, 04:49 (🦋) /econometrics/ $ show wp
Dataset wp | Showing 10 of 4360 rows
┏━━━┳━━━━┳━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ ┃ nr ┃ year ┃ black ┃ exper ┃ hisp ┃ hours ┃ married ┃ educ ┃ union ┃ lwage ┃ expersq ┃ occupation ┃ after_1990 ┃
┡━━━╇━━━━╇━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ 0 │ 13 │ 1980 │ 0 │ 1 │ 0 │ 2672 │ 0 │ 14 │ 0 │ 1.20 │ 1 │ 9 │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┤
│ 1 │ 13 │ 1981 │ 0 │ 2 │ 0 │ 2320 │ 0 │ 14 │ 1 │ 1.85 │ 4 │ 9 │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┤
│ 2 │ 13 │ 1982 │ 0 │ 3 │ 0 │ 2940 │ 0 │ 14 │ 0 │ 1.34 │ 9 │ 9 │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┤
│ 3 │ 13 │ 1983 │ 0 │ 4 │ 0 │ 2960 │ 0 │ 14 │ 0 │ 1.43 │ 16 │ 9 │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┤
│ 4 │ 13 │ 1984 │ 0 │ 5 │ 0 │ 3071 │ 0 │ 14 │ 0 │ 1.57 │ 25 │ 5 │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┤
│ 5 │ 13 │ 1985 │ 0 │ 6 │ 0 │ 2864 │ 0 │ 14 │ 0 │ 1.70 │ 36 │ 2 │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┤
│ 6 │ 13 │ 1986 │ 0 │ 7 │ 0 │ 2994 │ 0 │ 14 │ 0 │ -0.72 │ 49 │ 2 │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┤
│ 7 │ 13 │ 1987 │ 0 │ 8 │ 0 │ 2640 │ 0 │ 14 │ 0 │ 1.67 │ 64 │ 2 │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┤
│ 8 │ 17 │ 1980 │ 0 │ 4 │ 0 │ 2484 │ 0 │ 13 │ 0 │ 1.68 │ 16 │ 2 │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┤
│ 9 │ 17 │ 1981 │ 0 │ 5 │ 0 │ 2804 │ 0 │ 13 │ 0 │ 1.52 │ 25 │ 2 │ False │
└───┴────┴──────┴───────┴───────┴──────┴───────┴─────────┴──────┴───────┴───────┴─────────┴────────────┴────────────┘
2022 May 31, 04:49 (🦋) /econometrics/ $ add -n wp.after_1985 -b wp.year -s -c 1985
2022 May 31, 04:50 (🦋) /econometrics/ $ show wp
Dataset wp | Showing 10 of 4360 rows
┏━━━┳━━━━┳━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ ┃ nr ┃ year ┃ black ┃ exper ┃ hisp ┃ hours ┃ married ┃ educ ┃ union ┃ lwage ┃ expersq ┃ occupation ┃ after_1990 ┃ after_1985 ┃
┡━━━╇━━━━╇━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ 0 │ 13 │ 1980 │ 0 │ 1 │ 0 │ 2672 │ 0 │ 14 │ 0 │ 1.20 │ 1 │ 9 │ False │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┼────────────┤
│ 1 │ 13 │ 1981 │ 0 │ 2 │ 0 │ 2320 │ 0 │ 14 │ 1 │ 1.85 │ 4 │ 9 │ False │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┼────────────┤
│ 2 │ 13 │ 1982 │ 0 │ 3 │ 0 │ 2940 │ 0 │ 14 │ 0 │ 1.34 │ 9 │ 9 │ False │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┼────────────┤
│ 3 │ 13 │ 1983 │ 0 │ 4 │ 0 │ 2960 │ 0 │ 14 │ 0 │ 1.43 │ 16 │ 9 │ False │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┼────────────┤
│ 4 │ 13 │ 1984 │ 0 │ 5 │ 0 │ 3071 │ 0 │ 14 │ 0 │ 1.57 │ 25 │ 5 │ False │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┼────────────┤
│ 5 │ 13 │ 1985 │ 0 │ 6 │ 0 │ 2864 │ 0 │ 14 │ 0 │ 1.70 │ 36 │ 2 │ False │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┼────────────┤
│ 6 │ 13 │ 1986 │ 0 │ 7 │ 0 │ 2994 │ 0 │ 14 │ 0 │ -0.72 │ 49 │ 2 │ False │ True │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┼────────────┤
│ 7 │ 13 │ 1987 │ 0 │ 8 │ 0 │ 2640 │ 0 │ 14 │ 0 │ 1.67 │ 64 │ 2 │ False │ True │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┼────────────┤
│ 8 │ 17 │ 1980 │ 0 │ 4 │ 0 │ 2484 │ 0 │ 13 │ 0 │ 1.68 │ 16 │ 2 │ False │ False │
├───┼────┼──────┼───────┼───────┼──────┼───────┼─────────┼──────┼───────┼───────┼─────────┼────────────┼────────────┼────────────┤
│ 9 │ 17 │ 1981 │ 0 │ 5 │ 0 │ 2804 │ 0 │ 13 │ 0 │ 1.52 │ 25 │ 2 │ False │ False │
└───┴────┴──────┴───────┴───────┴──────┴───────┴─────────┴──────┴───────┴───────┴─────────┴────────────┴────────────┴────────────┘
```
---