Skip to content

Commit

Permalink
add a fix to #764 (#766)
Browse files Browse the repository at this point in the history
* add a fix to #764

* run pre-commit

---------

Co-authored-by: Yury Kashnitsky <[email protected]>
  • Loading branch information
Yorko and Yury Kashnitsky authored Aug 19, 2024
1 parent bc96753 commit 9947165
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,10 @@
"\n",
"Let's use it to answer the question:\n",
"\n",
"**What are average values of numerical features for churned users?**\n"
"**What are average values of numerical features for churned users?**\n",
"\n",
"\n",
"Here we'll resort to an additional method `select_dtypes` to select all numeric columns."
]
},
{
Expand All @@ -299,14 +302,15 @@
"metadata": {},
"outputs": [],
"source": [
"df[df[\"Churn\"] == 1].mean()"
"df.select_dtypes(include=np.number)[df[\"Churn\"] == 1].mean()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**How much time (on average) do churned users spend on the phone during daytime?**"
"**How much time (on average) do churned users spend on the phone during daytime?**\n",
"\n"
]
},
{
Expand Down Expand Up @@ -396,7 +400,7 @@
"metadata": {},
"outputs": [],
"source": [
"df.apply(np.max)"
"df.apply('max')"
]
},
{
Expand Down Expand Up @@ -522,7 +526,7 @@
"source": [
"columns_to_show = [\"Total day minutes\", \"Total eve minutes\", \"Total night minutes\"]\n",
"\n",
"df.groupby([\"Churn\"])[columns_to_show].agg([np.mean, np.std, np.min, np.max])"
"df.groupby([\"Churn\"])[columns_to_show].agg(['mean', 'std', 'min', 'max'])"
]
},
{
Expand Down Expand Up @@ -809,7 +813,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -823,9 +827,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
Original file line number Diff line number Diff line change
Expand Up @@ -857,4 +857,4 @@ This section has been moved to Kaggle, please explore [this Notebook](https://ww
- ["Convex Optimization" by Stephen Boyd](https://www.amazon.com/Convex-Optimization-Stephen-Boyd/dp/0521833787)
- "Command-line Tools can be 235x Faster than your Hadoop Cluster" [post](https://adamdrake.com/command-line-tools-can-be-235x-faster-than-your-hadoop-cluster.html)
- Benchmarking various ML algorithms on Criteo 1TB dataset on [GitHub](https://github.com/rambler-digital-solutions/criteo-1tb-benchmark)
- [VW on FastML.com](http://fastml.com/blog/categories/vw/)
- [VW on FastML.com](http://fastml.com/blog/categories/vw/)

0 comments on commit 9947165

Please sign in to comment.