Skip to content

Commit

Permalink
Merge pull request #601 from bashtage/update-examples
Browse files Browse the repository at this point in the history
DOC: Update examples and reduce warnings
  • Loading branch information
bashtage authored May 31, 2024
2 parents 360054b + d58224a commit 9288df3
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/asset-pricing_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.10.12"
},
"pycharm": {
"stem_cell": {
Expand Down
2 changes: 1 addition & 1 deletion examples/asset-pricing_formulas.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.10.12"
},
"pycharm": {
"stem_cell": {
Expand Down
2 changes: 1 addition & 1 deletion examples/iv_absorbing-regression.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.10.12"
},
"pycharm": {
"stem_cell": {
Expand Down
2 changes: 1 addition & 1 deletion examples/iv_advanced-examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.10.12"
},
"nbsphinx": {
"allow_errors": true
Expand Down
2 changes: 1 addition & 1 deletion examples/iv_basic-examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.10.12"
},
"pycharm": {
"stem_cell": {
Expand Down
2 changes: 1 addition & 1 deletion examples/iv_using-formulas.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.10.12"
},
"pycharm": {
"stem_cell": {
Expand Down
16 changes: 11 additions & 5 deletions examples/panel_data-formats.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@
"metadata": {},
"outputs": [],
"source": [
"mi_data = data.set_index([\"fcode\", \"year\"])\n",
"orig_mi_data = data.set_index([\"fcode\", \"year\"])\n",
"# Subset to the relevant columns and drop missing to avoid warnings\n",
"mi_data = orig_mi_data[[\"lscrap\",\"hrsemp\"]]\n",
"mi_data = mi_data.dropna(axis=0, how=\"any\")\n",
"\n",
"print(mi_data.head())"
]
},
Expand Down Expand Up @@ -88,9 +92,9 @@
"source": [
"import numpy as np\n",
"\n",
"np_data = np.asarray(mi_data)\n",
"np_lscrap = np_data[:, mi_data.columns.get_loc(\"lscrap\")]\n",
"np_hrsemp = np_data[:, mi_data.columns.get_loc(\"hrsemp\")]\n",
"np_data = np.asarray(orig_mi_data)\n",
"np_lscrap = np_data[:, orig_mi_data.columns.get_loc(\"lscrap\")]\n",
"np_hrsemp = np_data[:, orig_mi_data.columns.get_loc(\"hrsemp\")]\n",
"nentity = mi_data.index.levels[0].shape[0]\n",
"ntime = mi_data.index.levels[1].shape[0]\n",
"np_lscrap = np_lscrap.reshape((nentity, ntime)).T\n",
Expand All @@ -104,6 +108,8 @@
"metadata": {},
"outputs": [],
"source": [
"# Warnings are inevitable when using NumPy with missing data\n",
"# since the arrays must be rectangular, and not ragged\n",
"res = PanelOLS(np_lscrap, np_hrsemp, entity_effects=True).fit()\n",
"print(res)"
]
Expand Down Expand Up @@ -224,7 +230,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.10.12"
},
"pycharm": {
"stem_cell": {
Expand Down
2 changes: 1 addition & 1 deletion examples/panel_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.10.12"
},
"pycharm": {
"stem_cell": {
Expand Down
2 changes: 1 addition & 1 deletion examples/panel_using-formulas.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.10.12"
},
"pycharm": {
"stem_cell": {
Expand Down
2 changes: 1 addition & 1 deletion examples/system_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.10.12"
},
"pycharm": {
"stem_cell": {
Expand Down
2 changes: 1 addition & 1 deletion examples/system_formulas.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.10.12"
},
"pycharm": {
"stem_cell": {
Expand Down
2 changes: 1 addition & 1 deletion examples/system_three-stage-ls.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.10.12"
},
"pycharm": {
"stem_cell": {
Expand Down

0 comments on commit 9288df3

Please sign in to comment.