Skip to content

Instantly share code, notes, and snippets.

@jamesmyatt
Last active December 9, 2018 17:09
Show Gist options
  • Save jamesmyatt/8c6aa9178346e25e3175500672714ca5 to your computer and use it in GitHub Desktop.
Save jamesmyatt/8c6aa9178346e25e3175500672714ca5 to your computer and use it in GitHub Desktop.
Pandas docstring examples for Series.any/all
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Untitled0.ipynb",
"version": "0.3.2",
"provenance": [],
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/jamesmyatt/8c6aa9178346e25e3175500672714ca5/untitled0.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"metadata": {
"id": "4bIiB0q47mjb",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"outputId": "e0e2d213-408c-4fb8-f9c8-eda6538e0bc7"
},
"cell_type": "code",
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"pd.__version__, np.__version__"
],
"execution_count": 8,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"('0.22.0', '1.14.6')"
]
},
"metadata": {
"tags": []
},
"execution_count": 8
}
]
},
{
"metadata": {
"id": "TwBxxR-Y7oY4",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"outputId": "19642004-bdd0-4783-d72e-06f05f82e366"
},
"cell_type": "code",
"source": [
"pd.Series([False, False]).any()"
],
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"False"
]
},
"metadata": {
"tags": []
},
"execution_count": 4
}
]
},
{
"metadata": {
"id": "yQP28SPx7ozu",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"outputId": "3d120790-6b24-4020-c690-b0123e49898d"
},
"cell_type": "code",
"source": [
"pd.Series([]).any()"
],
"execution_count": 5,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"False"
]
},
"metadata": {
"tags": []
},
"execution_count": 5
}
]
},
{
"metadata": {
"id": "6xuLKvfq7yyL",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"outputId": "27c1e31c-c6f5-4c48-c27a-784f51f19e04"
},
"cell_type": "code",
"source": [
"pd.Series([np.nan]).any()"
],
"execution_count": 9,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"False"
]
},
"metadata": {
"tags": []
},
"execution_count": 9
}
]
},
{
"metadata": {
"id": "KQSFPJMX71eA",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"outputId": "e5fde980-507f-4d26-aa27-6f2d0dbebea7"
},
"cell_type": "code",
"source": [
"pd.Series([np.nan]).any(skipna=False)"
],
"execution_count": 10,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"True"
]
},
"metadata": {
"tags": []
},
"execution_count": 10
}
]
},
{
"metadata": {
"id": "svLKcW0Q78ur",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"outputId": "d963c442-2675-4741-d1dc-395163e51fb9"
},
"cell_type": "code",
"source": [
"pd.Series([]).all()"
],
"execution_count": 11,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"True"
]
},
"metadata": {
"tags": []
},
"execution_count": 11
}
]
},
{
"metadata": {
"id": "xv8n3cCO8AEB",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"outputId": "b89cf5b1-f154-4371-c7c9-058a0e1b242c"
},
"cell_type": "code",
"source": [
"pd.Series([np.nan]).all()"
],
"execution_count": 12,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"True"
]
},
"metadata": {
"tags": []
},
"execution_count": 12
}
]
},
{
"metadata": {
"id": "4u1Da8G88CYh",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"outputId": "295a5731-5d9b-4d71-da4f-09a51be7ca2f"
},
"cell_type": "code",
"source": [
"pd.Series([np.nan]).all(skipna=False)"
],
"execution_count": 13,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"True"
]
},
"metadata": {
"tags": []
},
"execution_count": 13
}
]
},
{
"metadata": {
"id": "odn0mKSx8Edk",
"colab_type": "code",
"colab": {}
},
"cell_type": "code",
"source": [
""
],
"execution_count": 0,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment