blob: c52dfc4e7afb73bc260f7fdde4cef2b0120e751e [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>apache_beam.dataframe.pandas_top_level_functions &mdash; Apache Beam 2.47.0 documentation</title>
<script type="text/javascript" src="../../../_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<script type="text/javascript" src="../../../_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="../../../_static/js/theme.js"></script>
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../../../index.html" class="icon icon-home"> Apache Beam
</a>
<div class="version">
2.47.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.coders.html">apache_beam.coders package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.dataframe.html">apache_beam.dataframe package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.io.html">apache_beam.io package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.metrics.html">apache_beam.metrics package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.ml.html">apache_beam.ml package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.options.html">apache_beam.options package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.portability.html">apache_beam.portability package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.runners.html">apache_beam.runners package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.testing.html">apache_beam.testing package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.transforms.html">apache_beam.transforms package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.typehints.html">apache_beam.typehints package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.utils.html">apache_beam.utils package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.yaml.html">apache_beam.yaml package</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.error.html">apache_beam.error module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.pipeline.html">apache_beam.pipeline module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../apache_beam.pvalue.html">apache_beam.pvalue module</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../../index.html">Apache Beam</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../../index.html">Docs</a> &raquo;</li>
<li><a href="../../index.html">Module code</a> &raquo;</li>
<li>apache_beam.dataframe.pandas_top_level_functions</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1>Source code for apache_beam.dataframe.pandas_top_level_functions</h1><div class="highlight"><pre>
<span></span><span class="c1">#</span>
<span class="c1"># Licensed to the Apache Software Foundation (ASF) under one or more</span>
<span class="c1"># contributor license agreements. See the NOTICE file distributed with</span>
<span class="c1"># this work for additional information regarding copyright ownership.</span>
<span class="c1"># The ASF licenses this file to You under the Apache License, Version 2.0</span>
<span class="c1"># (the &quot;License&quot;); you may not use this file except in compliance with</span>
<span class="c1"># the License. You may obtain a copy of the License at</span>
<span class="c1">#</span>
<span class="c1"># http://www.apache.org/licenses/LICENSE-2.0</span>
<span class="c1">#</span>
<span class="c1"># Unless required by applicable law or agreed to in writing, software</span>
<span class="c1"># distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span>
<span class="c1"># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<span class="c1"># See the License for the specific language governing permissions and</span>
<span class="c1"># limitations under the License.</span>
<span class="sd">&quot;&quot;&quot;A module providing various functionality from the top-level pandas namespace.</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">re</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Mapping</span>
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
<span class="kn">from</span> <span class="nn">apache_beam.dataframe</span> <span class="kn">import</span> <span class="n">expressions</span>
<span class="kn">from</span> <span class="nn">apache_beam.dataframe</span> <span class="kn">import</span> <span class="n">frame_base</span>
<span class="kn">from</span> <span class="nn">apache_beam.dataframe</span> <span class="kn">import</span> <span class="n">partitionings</span>
<span class="k">def</span> <span class="nf">_call_on_first_arg</span><span class="p">(</span><span class="n">name</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">wrapper</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">frame_base</span><span class="o">.</span><span class="n">DeferredBase</span><span class="p">):</span>
<span class="k">return</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">name</span><span class="p">)(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">pd</span><span class="p">,</span> <span class="n">name</span><span class="p">)(</span><span class="n">target</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">return</span> <span class="nb">staticmethod</span><span class="p">(</span><span class="n">wrapper</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">_maybe_wrap_constant_expr</span><span class="p">(</span><span class="n">res</span><span class="p">):</span>
<span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="n">res</span><span class="p">)</span> <span class="ow">in</span> <span class="n">frame_base</span><span class="o">.</span><span class="n">DeferredBase</span><span class="o">.</span><span class="n">_pandas_type_map</span><span class="p">:</span>
<span class="k">return</span> <span class="n">frame_base</span><span class="o">.</span><span class="n">DeferredBase</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span>
<span class="n">expressions</span><span class="o">.</span><span class="n">ConstantExpression</span><span class="p">(</span><span class="n">res</span><span class="p">,</span> <span class="n">res</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">0</span><span class="p">]))</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="n">res</span>
<span class="k">def</span> <span class="nf">_defer_to_pandas</span><span class="p">(</span><span class="n">name</span><span class="p">):</span>
<span class="n">func</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">pd</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">wrapper</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="n">res</span> <span class="o">=</span> <span class="n">func</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">return</span> <span class="n">_maybe_wrap_constant_expr</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
<span class="k">return</span> <span class="nb">staticmethod</span><span class="p">(</span><span class="n">wrapper</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">_defer_to_pandas_maybe_elementwise</span><span class="p">(</span><span class="n">name</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot; Same as _defer_to_pandas, except it handles DeferredBase args, assuming</span>
<span class="sd"> the function can be processed elementwise. &quot;&quot;&quot;</span>
<span class="n">func</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">pd</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">wrapper</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="n">frame_base</span><span class="o">.</span><span class="n">DeferredBase</span><span class="p">)</span>
<span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span> <span class="o">+</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">kwargs</span><span class="o">.</span><span class="n">values</span><span class="p">())):</span>
<span class="k">return</span> <span class="n">frame_base</span><span class="o">.</span><span class="n">_elementwise_function</span><span class="p">(</span><span class="n">func</span><span class="p">,</span> <span class="n">name</span><span class="p">)(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="n">res</span> <span class="o">=</span> <span class="n">func</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">return</span> <span class="n">_maybe_wrap_constant_expr</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
<span class="k">return</span> <span class="nb">staticmethod</span><span class="p">(</span><span class="n">wrapper</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">_is_top_level_function</span><span class="p">(</span><span class="n">o</span><span class="p">):</span>
<span class="k">return</span> <span class="p">(</span>
<span class="nb">callable</span><span class="p">(</span><span class="n">o</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">o</span><span class="p">,</span> <span class="nb">type</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">o</span><span class="p">,</span> <span class="s1">&#39;__name__&#39;</span><span class="p">)</span> <span class="ow">and</span>
<span class="n">re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="s1">&#39;[a-z].*&#39;</span><span class="p">,</span> <span class="n">o</span><span class="o">.</span><span class="vm">__name__</span><span class="p">))</span>
<div class="viewcode-block" id="DeferredPandasModule"><a class="viewcode-back" href="../../../apache_beam.dataframe.pandas_top_level_functions.html#apache_beam.dataframe.pandas_top_level_functions.DeferredPandasModule">[docs]</a><span class="k">class</span> <span class="nc">DeferredPandasModule</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="n">array</span> <span class="o">=</span> <span class="n">_defer_to_pandas</span><span class="p">(</span><span class="s1">&#39;array&#39;</span><span class="p">)</span>
<span class="n">bdate_range</span> <span class="o">=</span> <span class="n">_defer_to_pandas</span><span class="p">(</span><span class="s1">&#39;bdate_range&#39;</span><span class="p">)</span>
<div class="viewcode-block" id="DeferredPandasModule.concat"><a class="viewcode-back" href="../../../apache_beam.dataframe.pandas_top_level_functions.html#apache_beam.dataframe.pandas_top_level_functions.DeferredPandasModule.concat">[docs]</a> <span class="nd">@staticmethod</span>
<span class="nd">@frame_base</span><span class="o">.</span><span class="n">args_to_kwargs</span><span class="p">(</span><span class="n">pd</span><span class="p">)</span>
<span class="nd">@frame_base</span><span class="o">.</span><span class="n">populate_defaults</span><span class="p">(</span><span class="n">pd</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">concat</span><span class="p">(</span>
<span class="n">objs</span><span class="p">,</span>
<span class="n">axis</span><span class="p">,</span>
<span class="n">join</span><span class="p">,</span>
<span class="n">ignore_index</span><span class="p">,</span>
<span class="n">keys</span><span class="p">,</span>
<span class="n">levels</span><span class="p">,</span>
<span class="n">names</span><span class="p">,</span>
<span class="n">verify_integrity</span><span class="p">,</span>
<span class="n">sort</span><span class="p">,</span>
<span class="n">copy</span><span class="p">):</span>
<span class="k">if</span> <span class="n">ignore_index</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s1">&#39;concat(ignore_index)&#39;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">levels</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s1">&#39;concat(levels)&#39;</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">objs</span><span class="p">,</span> <span class="n">Mapping</span><span class="p">):</span>
<span class="k">if</span> <span class="n">keys</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">keys</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">objs</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>
<span class="n">objs</span> <span class="o">=</span> <span class="p">[</span><span class="n">objs</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">]</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">objs</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">objs</span><span class="p">)</span>
<span class="k">if</span> <span class="n">keys</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">preserves_partitioning</span> <span class="o">=</span> <span class="n">partitionings</span><span class="o">.</span><span class="n">Arbitrary</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># Index 0 will be a new index for keys, only partitioning by the original</span>
<span class="c1"># indexes (1 to N) will be preserved.</span>
<span class="n">nlevels</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="n">o</span><span class="o">.</span><span class="n">_expr</span><span class="o">.</span><span class="n">proxy</span><span class="p">()</span><span class="o">.</span><span class="n">index</span><span class="o">.</span><span class="n">nlevels</span> <span class="k">for</span> <span class="n">o</span> <span class="ow">in</span> <span class="n">objs</span><span class="p">)</span>
<span class="n">preserves_partitioning</span> <span class="o">=</span> <span class="n">partitionings</span><span class="o">.</span><span class="n">Index</span><span class="p">(</span>
<span class="p">[</span><span class="n">i</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">nlevels</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)])</span>
<span class="n">deferred_none</span> <span class="o">=</span> <span class="n">expressions</span><span class="o">.</span><span class="n">ConstantExpression</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span>
<span class="n">exprs</span> <span class="o">=</span> <span class="p">[</span><span class="n">deferred_none</span> <span class="k">if</span> <span class="n">o</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">o</span><span class="o">.</span><span class="n">_expr</span> <span class="k">for</span> <span class="n">o</span> <span class="ow">in</span> <span class="n">objs</span><span class="p">]</span>
<span class="k">if</span> <span class="n">axis</span> <span class="ow">in</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="s1">&#39;columns&#39;</span><span class="p">):</span>
<span class="n">required_partitioning</span> <span class="o">=</span> <span class="n">partitionings</span><span class="o">.</span><span class="n">Index</span><span class="p">()</span>
<span class="k">elif</span> <span class="n">verify_integrity</span><span class="p">:</span>
<span class="n">required_partitioning</span> <span class="o">=</span> <span class="n">partitionings</span><span class="o">.</span><span class="n">Index</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">required_partitioning</span> <span class="o">=</span> <span class="n">partitionings</span><span class="o">.</span><span class="n">Arbitrary</span><span class="p">()</span>
<span class="k">return</span> <span class="n">frame_base</span><span class="o">.</span><span class="n">DeferredBase</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span>
<span class="n">expressions</span><span class="o">.</span><span class="n">ComputedExpression</span><span class="p">(</span>
<span class="s1">&#39;concat&#39;</span><span class="p">,</span>
<span class="k">lambda</span> <span class="o">*</span><span class="n">objs</span><span class="p">:</span> <span class="n">pd</span><span class="o">.</span><span class="n">concat</span><span class="p">(</span>
<span class="n">objs</span><span class="p">,</span>
<span class="n">axis</span><span class="o">=</span><span class="n">axis</span><span class="p">,</span>
<span class="n">join</span><span class="o">=</span><span class="n">join</span><span class="p">,</span>
<span class="n">ignore_index</span><span class="o">=</span><span class="n">ignore_index</span><span class="p">,</span>
<span class="n">keys</span><span class="o">=</span><span class="n">keys</span><span class="p">,</span>
<span class="n">levels</span><span class="o">=</span><span class="n">levels</span><span class="p">,</span>
<span class="n">names</span><span class="o">=</span><span class="n">names</span><span class="p">,</span>
<span class="n">verify_integrity</span><span class="o">=</span><span class="n">verify_integrity</span><span class="p">),</span> <span class="c1"># yapf break</span>
<span class="n">exprs</span><span class="p">,</span>
<span class="n">requires_partition_by</span><span class="o">=</span><span class="n">required_partitioning</span><span class="p">,</span>
<span class="n">preserves_partition_by</span><span class="o">=</span><span class="n">preserves_partitioning</span><span class="p">))</span></div>
<span class="n">date_range</span> <span class="o">=</span> <span class="n">_defer_to_pandas</span><span class="p">(</span><span class="s1">&#39;date_range&#39;</span><span class="p">)</span>
<span class="n">describe_option</span> <span class="o">=</span> <span class="n">_defer_to_pandas</span><span class="p">(</span><span class="s1">&#39;describe_option&#39;</span><span class="p">)</span>
<span class="n">factorize</span> <span class="o">=</span> <span class="n">_call_on_first_arg</span><span class="p">(</span><span class="s1">&#39;factorize&#39;</span><span class="p">)</span>
<span class="n">get_option</span> <span class="o">=</span> <span class="n">_defer_to_pandas</span><span class="p">(</span><span class="s1">&#39;get_option&#39;</span><span class="p">)</span>
<span class="n">interval_range</span> <span class="o">=</span> <span class="n">_defer_to_pandas</span><span class="p">(</span><span class="s1">&#39;interval_range&#39;</span><span class="p">)</span>
<span class="n">isna</span> <span class="o">=</span> <span class="n">_call_on_first_arg</span><span class="p">(</span><span class="s1">&#39;isna&#39;</span><span class="p">)</span>
<span class="n">isnull</span> <span class="o">=</span> <span class="n">_call_on_first_arg</span><span class="p">(</span><span class="s1">&#39;isnull&#39;</span><span class="p">)</span>
<span class="n">json_normalize</span> <span class="o">=</span> <span class="n">_defer_to_pandas</span><span class="p">(</span><span class="s1">&#39;json_normalize&#39;</span><span class="p">)</span>
<span class="n">melt</span> <span class="o">=</span> <span class="n">_call_on_first_arg</span><span class="p">(</span><span class="s1">&#39;melt&#39;</span><span class="p">)</span>
<span class="n">merge</span> <span class="o">=</span> <span class="n">_call_on_first_arg</span><span class="p">(</span><span class="s1">&#39;merge&#39;</span><span class="p">)</span>
<span class="n">melt</span> <span class="o">=</span> <span class="n">_call_on_first_arg</span><span class="p">(</span><span class="s1">&#39;melt&#39;</span><span class="p">)</span>
<span class="n">merge_ordered</span> <span class="o">=</span> <span class="n">frame_base</span><span class="o">.</span><span class="n">wont_implement_method</span><span class="p">(</span>
<span class="n">pd</span><span class="p">,</span> <span class="s1">&#39;merge_ordered&#39;</span><span class="p">,</span> <span class="n">reason</span><span class="o">=</span><span class="s1">&#39;order-sensitive&#39;</span><span class="p">)</span>
<span class="n">notna</span> <span class="o">=</span> <span class="n">_call_on_first_arg</span><span class="p">(</span><span class="s1">&#39;notna&#39;</span><span class="p">)</span>
<span class="n">notnull</span> <span class="o">=</span> <span class="n">_call_on_first_arg</span><span class="p">(</span><span class="s1">&#39;notnull&#39;</span><span class="p">)</span>
<span class="n">option_context</span> <span class="o">=</span> <span class="n">_defer_to_pandas</span><span class="p">(</span><span class="s1">&#39;option_context&#39;</span><span class="p">)</span>
<span class="n">period_range</span> <span class="o">=</span> <span class="n">_defer_to_pandas</span><span class="p">(</span><span class="s1">&#39;period_range&#39;</span><span class="p">)</span>
<span class="n">pivot</span> <span class="o">=</span> <span class="n">_call_on_first_arg</span><span class="p">(</span><span class="s1">&#39;pivot&#39;</span><span class="p">)</span>
<span class="n">pivot_table</span> <span class="o">=</span> <span class="n">_call_on_first_arg</span><span class="p">(</span><span class="s1">&#39;pivot_table&#39;</span><span class="p">)</span>
<span class="n">show_versions</span> <span class="o">=</span> <span class="n">_defer_to_pandas</span><span class="p">(</span><span class="s1">&#39;show_versions&#39;</span><span class="p">)</span>
<span class="n">test</span> <span class="o">=</span> <span class="n">frame_base</span><span class="o">.</span><span class="n">wont_implement_method</span><span class="p">(</span>
<span class="n">pd</span><span class="p">,</span>
<span class="s1">&#39;test&#39;</span><span class="p">,</span>
<span class="n">explanation</span><span class="o">=</span><span class="s2">&quot;because it is an internal pandas testing utility.&quot;</span><span class="p">)</span>
<span class="n">timedelta_range</span> <span class="o">=</span> <span class="n">_defer_to_pandas</span><span class="p">(</span><span class="s1">&#39;timedelta_range&#39;</span><span class="p">)</span>
<span class="n">to_pickle</span> <span class="o">=</span> <span class="n">frame_base</span><span class="o">.</span><span class="n">wont_implement_method</span><span class="p">(</span>
<span class="n">pd</span><span class="p">,</span> <span class="s1">&#39;to_pickle&#39;</span><span class="p">,</span> <span class="n">reason</span><span class="o">=</span><span class="s1">&#39;order-sensitive&#39;</span><span class="p">)</span>
<span class="n">to_datetime</span> <span class="o">=</span> <span class="n">_defer_to_pandas_maybe_elementwise</span><span class="p">(</span><span class="s1">&#39;to_datetime&#39;</span><span class="p">)</span>
<span class="n">notna</span> <span class="o">=</span> <span class="n">_call_on_first_arg</span><span class="p">(</span><span class="s1">&#39;notna&#39;</span><span class="p">)</span>
<span class="k">def</span> <span class="fm">__getattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
<span class="k">if</span> <span class="n">name</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s1">&#39;read_&#39;</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="k">raise</span> <span class="n">frame_base</span><span class="o">.</span><span class="n">WontImplementError</span><span class="p">(</span>
<span class="s1">&#39;Use p | apache_beam.dataframe.io.</span><span class="si">%s</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="n">name</span><span class="p">)</span>
<span class="k">return</span> <span class="n">func</span>
<span class="n">res</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">pd</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
<span class="k">if</span> <span class="n">_is_top_level_function</span><span class="p">(</span><span class="n">res</span><span class="p">):</span>
<span class="k">return</span> <span class="n">frame_base</span><span class="o">.</span><span class="n">not_implemented_method</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">base_type</span><span class="o">=</span><span class="n">pd</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="n">res</span></div>
<span class="n">pd_wrapper</span> <span class="o">=</span> <span class="n">DeferredPandasModule</span><span class="p">()</span>
</pre></div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>