Files
OpenBB/website/content/terminal/reference/econometrics/add.md
teh_coderer 79046608b6 Docs Fix (#3543)
* Update generate_terminal_markdown.py

* updates

* update workflows

* Automated Change

* tests

* tests

* Automated Change

* Update test_generate_docs.py

* Automated Change

* updates

* Automated Change

* Update gen-docs.yml

* Update test.yml

* Automated Change

* Update test.yml

* Automated Change

* Update generate_sdk_markdown.py

* Automated Change

* test

* Automated Change

* testtt23

* Automated Change

* Update generate_sdk_markdown.py

* Automated Change

* Automated Change

* added empting reference folders before autogen docs

* updates

* Automated Change

* update tests gitactions

* Automated Change

* up

* Automated Change

* Automated Change

* update pytest

* Automated Change

* tests

* Automated Change

* examples update

* Automated Change

* Update generate_sdk_markdown.py

* Automated Change

* Update test.yml

* Update generate_sdk_markdown.py

* strip

* Automated Change

* Workflow : check test update

* Automated Change

* Automated Change

* Automated Change

* Update test.yml

* Automated Change

* Update test.yml

* Automated Change

* Automated Change

* up

* Automated Change

* Update generate_sdk_markdown.py

* Automated Change

* update workflows

* fix guides

* testing

* Update gh-pages.yml

* Update gh-pages.yml

Co-authored-by: tehcoderer <tehcoderer@users.noreply.github.com>
Co-authored-by: Jeroen Bouma <jer.bouma@gmail.com>
Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
Co-authored-by: Chavithra <Chavithra@users.noreply.github.com>
Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com>
Co-authored-by: jose-donato <jose-donato@users.noreply.github.com>
2022-11-25 17:19:08 -05:00

14 KiB
Vendored

title, description
title description
add OpenBB Terminal Function

add

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

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

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      │
└───┴────┴──────┴───────┴───────┴──────┴───────┴─────────┴──────┴───────┴───────┴─────────┴────────────┴────────────┴────────────┘