mirror of
https://github.com/elastic/eland.git
synced 2025-07-11 00:02:14 +08:00
198 lines
4.1 KiB
Plaintext
198 lines
4.1 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Add tests which "
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import eland as ed"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"ed_df = ed.DataFrame('http://localhost:9200', 'flights', columns=[\"AvgTicketPrice\", \"Cancelled\", \"dayOfWeek\", \"timestamp\", \"DestCountry\"])"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"AvgTicketPrice 639.433214\n",
|
|
"Cancelled False\n",
|
|
"dayOfWeek 2\n",
|
|
"timestamp 2018-01-21 20:23:15.159835648\n",
|
|
"dtype: object"
|
|
]
|
|
},
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# NBVAL_IGNORE_OUTPUT\n",
|
|
"ed_df.median(numeric_only=None)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"AvgTicketPrice 639.433214\n",
|
|
"Cancelled 0.000000\n",
|
|
"dayOfWeek 2.935777\n",
|
|
"dtype: float64"
|
|
]
|
|
},
|
|
"execution_count": 4,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# NBVAL_IGNORE_OUTPUT\n",
|
|
"ed_df.median(numeric_only=True)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"AvgTicketPrice 639.433214\n",
|
|
"Cancelled False\n",
|
|
"dayOfWeek 2\n",
|
|
"timestamp 2018-01-21 20:23:15.159835648\n",
|
|
"DestCountry NaN\n",
|
|
"dtype: object"
|
|
]
|
|
},
|
|
"execution_count": 5,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# NBVAL_IGNORE_OUTPUT\n",
|
|
"ed_df.median(numeric_only=False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"AvgTicketPrice 213.453156\n",
|
|
"dayOfWeek 2.000000\n",
|
|
"dtype: float64"
|
|
]
|
|
},
|
|
"execution_count": 6,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# NBVAL_IGNORE_OUTPUT\n",
|
|
"ed_df.mad(numeric_only=None)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"AvgTicketPrice 213.453156\n",
|
|
"dayOfWeek 2.000000\n",
|
|
"dtype: float64"
|
|
]
|
|
},
|
|
"execution_count": 7,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# NBVAL_IGNORE_OUTPUT\n",
|
|
"ed_df.mad(numeric_only=True)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"AvgTicketPrice 213.453156\n",
|
|
"Cancelled NaN\n",
|
|
"dayOfWeek 2.0\n",
|
|
"timestamp NaT\n",
|
|
"DestCountry NaN\n",
|
|
"dtype: object"
|
|
]
|
|
},
|
|
"execution_count": 8,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# NBVAL_IGNORE_OUTPUT\n",
|
|
"ed_df.mad(numeric_only=False)"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.10.13"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 4
|
|
}
|