Skip to content

Commit fea5529

Browse files
author
Hugo Bowne-Anderson
authored
Change pandas attribute syntax to selector syntax for column names
1 parent ba81dad commit fea5529

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

notebooks/1.Probability_a_simulated_introduction.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
"outputs": [],
228228
"source": [
229229
"# Store lengths in a pandas series\n",
230-
"lengths = df_12.blength"
230+
"lengths = df_12['blength']"
231231
]
232232
},
233233
{
@@ -615,7 +615,7 @@
615615
"metadata": {},
616616
"outputs": [],
617617
"source": [
618-
"df_fortis = df_12.loc[df_12.species == 'fortis']\n",
618+
"df_fortis = df_12.loc[df_12['species'] == 'fortis']\n",
619619
"sum(df_fortis.blength > 10)/len(df_fortis)"
620620
]
621621
},
@@ -625,7 +625,7 @@
625625
"metadata": {},
626626
"outputs": [],
627627
"source": [
628-
"df_scandens = df_12.loc[df_12.species == 'scandens']\n",
628+
"df_scandens = df_12.loc[df_12['species'] == 'scandens']\n",
629629
"sum(df_scandens.blength > 10)/len(df_scandens)"
630630
]
631631
},

notebooks/2.Parameter_estimation_hypothesis_testing.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@
324324
"source": [
325325
"# Import and view head of data\n",
326326
"df_12 = pd.read_csv('../data/finch_beaks_2012.csv')\n",
327-
"df_fortis = df_12.loc[df_12.species == 'fortis']\n",
328-
"df_scandens = df_12.loc[df_12.species == 'scandens']"
327+
"df_fortis = df_12.loc[df_12['species'] == 'fortis']\n",
328+
"df_scandens = df_12.loc[df_12['species'] == 'scandens']"
329329
]
330330
},
331331
{
@@ -341,7 +341,7 @@
341341
" μ_1 = pm.Normal('μ_1', mu=10, sd=5)\n",
342342
" σ_1 = pm.Lognormal('σ_1', 0, 10)\n",
343343
" # Gaussian Likelihood\n",
344-
" y_1 = pm.Normal('y_1', mu=μ_1, sd=σ_1, observed=df_fortis.blength)"
344+
" y_1 = pm.Normal('y_1', mu=μ_1, sd=σ_1, observed=df_fortis['blength'])"
345345
]
346346
},
347347
{
@@ -446,8 +446,8 @@
446446
" μ_2 = pm.Normal('μ_2', mu=10, sd=5)\n",
447447
" σ_2 = pm.Lognormal('σ_2', 0, 10)\n",
448448
" # Gaussian Likelihoods\n",
449-
" y_1 = pm.Normal('y_1', mu=μ_1, sd=σ_1, observed=df_fortis.blength)\n",
450-
" y_2 = pm.Normal('y_2', mu=μ_2, sd=σ_2, observed=df_scandens.blength)\n",
449+
" y_1 = pm.Normal('y_1', mu=μ_1, sd=σ_1, observed=df_fortis['blength'])\n",
450+
" y_2 = pm.Normal('y_2', mu=μ_2, sd=σ_2, observed=df_scandens['blength'])\n",
451451
" # Calculate the effect size and its uncertainty.\n",
452452
" diff_means = pm.Deterministic('diff_means', μ_1 - μ_2)\n",
453453
" pooled_sd = pm.Deterministic('pooled_sd', \n",

0 commit comments

Comments
 (0)