Files
OpenBB/website/content/econometrics/clean/_index.md
Jeroen Bouma f2ca215132 Econometrics Menu (#1403)
* Add Statistics Menu

* Add Granger Causality test

* Apply Black formatting

* Add Cointegration Tests

* Adjust plotting for Cointegration test

* Add Significant parameter to Cointegration tests

* Move regression functions to seperate .py files

* Progress on Panel Data

* A lot of progress for Panel Data

* Make functions robust and improve documentation

* Re-enable Breusch-Godfrey

* Add modify functionality

* Improve modify functionality

* Add Breusch-Pagan heteroscedasticity test

* Capitalize a word

* Include documentatin for the Statistics Menu

* Update _index.md

* Update _index.md

* Update _index.md

* Fix export statements and add Example datasets

* Update example with Longley's dataset

* Update documentation with a legit source

* Compare the results from each regression models based on the wage_panel dataset

* Updated with all relevant types of regression tables

* Update with all relevant regression types for Panel data

* Update _index.md

* Add change column type, improve OLS, add time and entity effects for FE

* Update documentation and fix a small bug

* Add in Statistics menu, replacing Custom menu

* Remove custom menu

* Add in documentation

* Add in gst files

* Cointegration can be used on any amount of columns

* Add Tests

* Make tests time invariant

* Update Poetry and Requirements

* Change name of Statistics menu to Econometrics menu

* Rename scripts

* Add type in Documentation

* Change names from Statistics to Econometrics

* Add graph

* Update tests with rounding and naming

* Make minor adjustments to fix the tests

* Updating tests : allow extra args for capture

* Apply recorder formatting

* Adding some minor formatting

* Fix error with MyPy

* Attempt to fix MyPy annoyance

* super small style things

* Fix small bugs and add plot command to dwat

* Small description mistake

* Update documentation with missing argument

* Update styling

* Add error handling and add improve show functionality

* Fix merge issue

* Allow import from custom_imports

Co-authored-by: Jeroen Bouma <jeroenbouma@MacBook-Pro-van-Jeroen.local>
Co-authored-by: jmaslek <jmaslek11@gmail.com>
Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
2022-03-04 21:44:59 +01:00

27 KiB
Vendored

usage: clean [-n NAME] [-f {rfill,cfill,rbfill,cbfill,rffill,bffill}] [-d {rdrop,cdrop}] [-l LIMIT] [-h]

Clean a dataset by filling and/or dropping NaN values.

optional arguments:
  -n NAME, --name NAME  The name of the dataset you want to clean up (default: None)
  -f {rfill,cfill,rbfill,cbfill,rffill,bffill}, --fill {rfill,cfill,rbfill,cbfill,rffill,bffill}
                        The method of filling NaNs. This has options to fill rows (rfill, rbfill, rffill) or fill columns (cfill, cbfill, cffill). Furthermore, it has the option to forward fill and backward fill (up to --limit) which
                        refer to how many rows/columns can be set equal to the last non-NaN value (default: )
  -d {rdrop,cdrop}, --drop {rdrop,cdrop}
                        The method of dropping NaNs. This either has the option rdrop (drop rows that contain NaNs) or cdrop (drop columns that contain NaNs) (default: )
  -l LIMIT, --limit LIMIT
                        The max amount of columns/rows backward filled or forward filled that have NaNs or the max amount of columns/rows that have NaNs before being dropped. (default: 5)
  -h, --help            show this help message (default: False)

Example:

2022 Feb 24, 04:58 (✨) /econometrics/ $ show thesis
                                                                                thesis                                                                                 
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃                                                ┃ current_assets ┃ assets  ┃ debt   ┃ depr_amor ┃ income ┃ current_liabilities ┃ revenue ┃ equity ┃ interest_expense ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ ('AAR Corp', Timestamp('2016-01-01 00:00:00')) │ 970.70         │ 1522.00 │ 160.00 │ 18.50     │ 9.90   │ 359.70              │ 412.10  │ 858.30 │ 1.70             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2016-04-01 00:00:00')) │ 873.10         │ 1442.10 │ 136.10 │ 17.80     │ 11.80  │ 329.00              │ 468.60  │ 865.80 │ 1.20             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2016-07-01 00:00:00')) │ 849.40         │ 1427.00 │ 142.80 │ nan       │ 9.90   │ 314.40              │ 404.80  │ 858.50 │ 1.30             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2016-10-01 00:00:00')) │ 901.80         │ 1486.60 │ 154.10 │ nan       │ 11.40  │ 350.90              │ 328.30  │ 872.40 │ 1.10             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2017-01-01 00:00:00')) │ 893.10         │ 1502.10 │ 168.70 │ nan       │ 14.40  │ 342.80              │ 407.20  │ 885.70 │ 1.40             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2017-04-01 00:00:00')) │ 888.50         │ 1504.10 │ 155.30 │ nan       │ 16.30  │ 335.10              │ 450.50  │ 914.20 │ 1.50             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2017-07-01 00:00:00')) │ 904.70         │ 1531.70 │ 189.00 │ 10.20     │ 11.00  │ 312.10              │ 397.90  │ 924.70 │ 1.70             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2017-10-01 00:00:00')) │ 892.20         │ 1544.30 │ 215.80 │ 10.60     │ 13.30  │ 336.50              │ 420.60  │ 906.50 │ 1.90             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2018-01-01 00:00:00')) │ 933.60         │ 1512.20 │ 194.30 │ 10.60     │ 31.30  │ 326.60              │ 456.30  │ 915.20 │ 2.20             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2018-04-01 00:00:00')) │ 942.70         │ 1524.70 │ 177.20 │ 9.10      │ 18.10  │ 333.30              │ 473.50  │ 936.30 │ 2.20             │
└────────────────────────────────────────────────┴────────────────┴─────────┴────────┴───────────┴────────┴─────────────────────┴─────────┴────────┴──────────────────┘
2022 Feb 24, 04:58 (✨) /econometrics/ $ clean thesis -f rfill

2022 Feb 24, 04:59 (✨) /econometrics/ $ show thesis
                                                                                thesis                                                                                 
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃                                                ┃ current_assets ┃ assets  ┃ debt   ┃ depr_amor ┃ income ┃ current_liabilities ┃ revenue ┃ equity ┃ interest_expense ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ ('AAR Corp', Timestamp('2016-01-01 00:00:00')) │ 970.70         │ 1522.00 │ 160.00 │ 18.50     │ 9.90   │ 359.70              │ 412.10  │ 858.30 │ 1.70             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2016-04-01 00:00:00')) │ 873.10         │ 1442.10 │ 136.10 │ 17.80     │ 11.80  │ 329.00              │ 468.60  │ 865.80 │ 1.20             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2016-07-01 00:00:00')) │ 849.40         │ 1427.00 │ 142.80 │ 0.00      │ 9.90   │ 314.40              │ 404.80  │ 858.50 │ 1.30             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2016-10-01 00:00:00')) │ 901.80         │ 1486.60 │ 154.10 │ 0.00      │ 11.40  │ 350.90              │ 328.30  │ 872.40 │ 1.10             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2017-01-01 00:00:00')) │ 893.10         │ 1502.10 │ 168.70 │ 0.00      │ 14.40  │ 342.80              │ 407.20  │ 885.70 │ 1.40             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2017-04-01 00:00:00')) │ 888.50         │ 1504.10 │ 155.30 │ 0.00      │ 16.30  │ 335.10              │ 450.50  │ 914.20 │ 1.50             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2017-07-01 00:00:00')) │ 904.70         │ 1531.70 │ 189.00 │ 10.20     │ 11.00  │ 312.10              │ 397.90  │ 924.70 │ 1.70             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2017-10-01 00:00:00')) │ 892.20         │ 1544.30 │ 215.80 │ 10.60     │ 13.30  │ 336.50              │ 420.60  │ 906.50 │ 1.90             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2018-01-01 00:00:00')) │ 933.60         │ 1512.20 │ 194.30 │ 10.60     │ 31.30  │ 326.60              │ 456.30  │ 915.20 │ 2.20             │
├────────────────────────────────────────────────┼────────────────┼─────────┼────────┼───────────┼────────┼─────────────────────┼─────────┼────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2018-04-01 00:00:00')) │ 942.70         │ 1524.70 │ 177.20 │ 9.10      │ 18.10  │ 333.30              │ 473.50  │ 936.30 │ 2.20             │
└────────────────────────────────────────────────┴────────────────┴─────────┴────────┴───────────┴────────┴─────────────────────┴─────────┴────────┴──────────────────┘
2022 Feb 24, 04:59 (✨) /econometrics/ $ clean thesis -d rdrop

2022 Feb 24, 05:00 (✨) /econometrics/ $ show thesis
                                                                                            thesis                                                                                            
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃                                                                   ┃ current_assets ┃ assets   ┃ debt     ┃ depr_amor ┃ income ┃ current_liabilities ┃ revenue ┃ equity  ┃ interest_expense ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ ('AAR Corp', Timestamp('2016-01-01 00:00:00'))                    │ 970.70         │ 1522.00  │ 160.00   │ 18.50     │ 9.90   │ 359.70              │ 412.10  │ 858.30  │ 1.70             │
├───────────────────────────────────────────────────────────────────┼────────────────┼──────────┼──────────┼───────────┼────────┼─────────────────────┼─────────┼─────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2016-04-01 00:00:00'))                    │ 873.10         │ 1442.10  │ 136.10   │ 17.80     │ 11.80  │ 329.00              │ 468.60  │ 865.80  │ 1.20             │
├───────────────────────────────────────────────────────────────────┼────────────────┼──────────┼──────────┼───────────┼────────┼─────────────────────┼─────────┼─────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2017-07-01 00:00:00'))                    │ 904.70         │ 1531.70  │ 189.00   │ 10.20     │ 11.00  │ 312.10              │ 397.90  │ 924.70  │ 1.70             │
├───────────────────────────────────────────────────────────────────┼────────────────┼──────────┼──────────┼───────────┼────────┼─────────────────────┼─────────┼─────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2017-10-01 00:00:00'))                    │ 892.20         │ 1544.30  │ 215.80   │ 10.60     │ 13.30  │ 336.50              │ 420.60  │ 906.50  │ 1.90             │
├───────────────────────────────────────────────────────────────────┼────────────────┼──────────┼──────────┼───────────┼────────┼─────────────────────┼─────────┼─────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2018-01-01 00:00:00'))                    │ 933.60         │ 1512.20  │ 194.30   │ 10.60     │ 31.30  │ 326.60              │ 456.30  │ 915.20  │ 2.20             │
├───────────────────────────────────────────────────────────────────┼────────────────┼──────────┼──────────┼───────────┼────────┼─────────────────────┼─────────┼─────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2018-04-01 00:00:00'))                    │ 942.70         │ 1524.70  │ 177.20   │ 9.10      │ 18.10  │ 333.30              │ 473.50  │ 936.30  │ 2.20             │
├───────────────────────────────────────────────────────────────────┼────────────────┼──────────┼──────────┼───────────┼────────┼─────────────────────┼─────────┼─────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2018-07-01 00:00:00'))                    │ 982.40         │ 1537.80  │ 209.10   │ 10.10     │ 18.90  │ 315.10              │ 466.30  │ 929.10  │ 2.10             │
├───────────────────────────────────────────────────────────────────┼────────────────┼──────────┼──────────┼───────────┼────────┼─────────────────────┼─────────┼─────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2018-10-01 00:00:00'))                    │ 1040.70        │ 1604.20  │ 218.90   │ 10.40     │ 11.20  │ 344.20              │ 493.30  │ 935.60  │ 2.50             │
├───────────────────────────────────────────────────────────────────┼────────────────┼──────────┼──────────┼───────────┼────────┼─────────────────────┼─────────┼─────────┼──────────────────┤
│ ('AAR Corp', Timestamp('2019-01-01 00:00:00'))                    │ 993.40         │ 1546.50  │ 177.20   │ 10.80     │ 27.40  │ 359.60              │ 529.50  │ 899.40  │ 2.60             │
├───────────────────────────────────────────────────────────────────┼────────────────┼──────────┼──────────┼───────────┼────────┼─────────────────────┼─────────┼─────────┼──────────────────┤
│ ('American Airlines Group Inc', Timestamp('2016-01-01 00:00:00')) │ 10802.00       │ 49909.00 │ 19134.00 │ 423.00    │ 700.00 │ 15277.00            │ 9435.00 │ 4710.00 │ 250.00           │
└───────────────────────────────────────────────────────────────────┴────────────────┴──────────┴──────────┴───────────┴────────┴─────────────────────┴─────────┴─────────┴──────────────────┘