Skip to content

Commit 9288df3

Browse files
authored
Merge pull request #601 from bashtage/update-examples
DOC: Update examples and reduce warnings
2 parents 360054b + d58224a commit 9288df3

12 files changed

+22
-16
lines changed

examples/asset-pricing_examples.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@
412412
"name": "python",
413413
"nbconvert_exporter": "python",
414414
"pygments_lexer": "ipython3",
415-
"version": "3.12.0"
415+
"version": "3.10.12"
416416
},
417417
"pycharm": {
418418
"stem_cell": {

examples/asset-pricing_formulas.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
"name": "python",
140140
"nbconvert_exporter": "python",
141141
"pygments_lexer": "ipython3",
142-
"version": "3.12.0"
142+
"version": "3.10.12"
143143
},
144144
"pycharm": {
145145
"stem_cell": {

examples/iv_absorbing-regression.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
"name": "python",
152152
"nbconvert_exporter": "python",
153153
"pygments_lexer": "ipython3",
154-
"version": "3.12.0"
154+
"version": "3.10.12"
155155
},
156156
"pycharm": {
157157
"stem_cell": {

examples/iv_advanced-examples.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@
572572
"name": "python",
573573
"nbconvert_exporter": "python",
574574
"pygments_lexer": "ipython3",
575-
"version": "3.12.0"
575+
"version": "3.10.12"
576576
},
577577
"nbsphinx": {
578578
"allow_errors": true

examples/iv_basic-examples.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@
802802
"name": "python",
803803
"nbconvert_exporter": "python",
804804
"pygments_lexer": "ipython3",
805-
"version": "3.12.0"
805+
"version": "3.10.12"
806806
},
807807
"pycharm": {
808808
"stem_cell": {

examples/iv_using-formulas.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
"name": "python",
193193
"nbconvert_exporter": "python",
194194
"pygments_lexer": "ipython3",
195-
"version": "3.12.0"
195+
"version": "3.10.12"
196196
},
197197
"pycharm": {
198198
"stem_cell": {

examples/panel_data-formats.ipynb

+11-5
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@
4747
"metadata": {},
4848
"outputs": [],
4949
"source": [
50-
"mi_data = data.set_index([\"fcode\", \"year\"])\n",
50+
"orig_mi_data = data.set_index([\"fcode\", \"year\"])\n",
51+
"# Subset to the relevant columns and drop missing to avoid warnings\n",
52+
"mi_data = orig_mi_data[[\"lscrap\",\"hrsemp\"]]\n",
53+
"mi_data = mi_data.dropna(axis=0, how=\"any\")\n",
54+
"\n",
5155
"print(mi_data.head())"
5256
]
5357
},
@@ -88,9 +92,9 @@
8892
"source": [
8993
"import numpy as np\n",
9094
"\n",
91-
"np_data = np.asarray(mi_data)\n",
92-
"np_lscrap = np_data[:, mi_data.columns.get_loc(\"lscrap\")]\n",
93-
"np_hrsemp = np_data[:, mi_data.columns.get_loc(\"hrsemp\")]\n",
95+
"np_data = np.asarray(orig_mi_data)\n",
96+
"np_lscrap = np_data[:, orig_mi_data.columns.get_loc(\"lscrap\")]\n",
97+
"np_hrsemp = np_data[:, orig_mi_data.columns.get_loc(\"hrsemp\")]\n",
9498
"nentity = mi_data.index.levels[0].shape[0]\n",
9599
"ntime = mi_data.index.levels[1].shape[0]\n",
96100
"np_lscrap = np_lscrap.reshape((nentity, ntime)).T\n",
@@ -104,6 +108,8 @@
104108
"metadata": {},
105109
"outputs": [],
106110
"source": [
111+
"# Warnings are inevitable when using NumPy with missing data\n",
112+
"# since the arrays must be rectangular, and not ragged\n",
107113
"res = PanelOLS(np_lscrap, np_hrsemp, entity_effects=True).fit()\n",
108114
"print(res)"
109115
]
@@ -224,7 +230,7 @@
224230
"name": "python",
225231
"nbconvert_exporter": "python",
226232
"pygments_lexer": "ipython3",
227-
"version": "3.12.0"
233+
"version": "3.10.12"
228234
},
229235
"pycharm": {
230236
"stem_cell": {

examples/panel_examples.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@
427427
"name": "python",
428428
"nbconvert_exporter": "python",
429429
"pygments_lexer": "ipython3",
430-
"version": "3.12.0"
430+
"version": "3.10.12"
431431
},
432432
"pycharm": {
433433
"stem_cell": {

examples/panel_using-formulas.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
"name": "python",
183183
"nbconvert_exporter": "python",
184184
"pygments_lexer": "ipython3",
185-
"version": "3.12.0"
185+
"version": "3.10.12"
186186
},
187187
"pycharm": {
188188
"stem_cell": {

examples/system_examples.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@
780780
"name": "python",
781781
"nbconvert_exporter": "python",
782782
"pygments_lexer": "ipython3",
783-
"version": "3.12.0"
783+
"version": "3.10.12"
784784
},
785785
"pycharm": {
786786
"stem_cell": {

examples/system_formulas.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
"name": "python",
180180
"nbconvert_exporter": "python",
181181
"pygments_lexer": "ipython3",
182-
"version": "3.12.0"
182+
"version": "3.10.12"
183183
},
184184
"pycharm": {
185185
"stem_cell": {

examples/system_three-stage-ls.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@
353353
"name": "python",
354354
"nbconvert_exporter": "python",
355355
"pygments_lexer": "ipython3",
356-
"version": "3.12.0"
356+
"version": "3.10.12"
357357
},
358358
"pycharm": {
359359
"stem_cell": {

0 commit comments

Comments
 (0)