<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pyspark.sql.column — PySpark master documentation</title>
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: 'master',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</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>
<link rel="top" title="PySpark master documentation" href="../../../index.html" />
<link rel="up" title="Module code" href="../../index.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="nav-item nav-item-0"><a href="../../../index.html">PySpark master documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="../../index.html" accesskey="U">Module code</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<h1>Source code for pyspark.sql.column</h1><div class="highlight"><pre>
<span class="c">#</span>
<span class="c"># Licensed to the Apache Software Foundation (ASF) under one or more</span>
<span class="c"># contributor license agreements. See the NOTICE file distributed with</span>
<span class="c"># this work for additional information regarding copyright ownership.</span>
<span class="c"># The ASF licenses this file to You under the Apache License, Version 2.0</span>
<span class="c"># (the "License"); you may not use this file except in compliance with</span>
<span class="c"># the License. You may obtain a copy of the License at</span>
<span class="c">#</span>
<span class="c"># http://www.apache.org/licenses/LICENSE-2.0</span>
<span class="c">#</span>
<span class="c"># Unless required by applicable law or agreed to in writing, software</span>
<span class="c"># distributed under the License is distributed on an "AS IS" BASIS,</span>
<span class="c"># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<span class="c"># See the License for the specific language governing permissions and</span>
<span class="c"># limitations under the License.</span>
<span class="c">#</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">import</span> <span class="nn">warnings</span>
<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">version</span> <span class="o">>=</span> <span class="s">'3'</span><span class="p">:</span>
<span class="nb">basestring</span> <span class="o">=</span> <span class="nb">str</span>
<span class="nb">long</span> <span class="o">=</span> <span class="nb">int</span>
<span class="kn">from</span> <span class="nn">pyspark.context</span> <span class="kn">import</span> <span class="n">SparkContext</span>
<span class="kn">from</span> <span class="nn">pyspark.rdd</span> <span class="kn">import</span> <span class="n">ignore_unicode_prefix</span>
<span class="kn">from</span> <span class="nn">pyspark.sql</span> <span class="kn">import</span> <span class="n">since</span>
<span class="kn">from</span> <span class="nn">pyspark.sql.types</span> <span class="kn">import</span> <span class="o">*</span>
<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span><span class="s">"DataFrame"</span><span class="p">,</span> <span class="s">"Column"</span><span class="p">,</span> <span class="s">"SchemaRDD"</span><span class="p">,</span> <span class="s">"DataFrameNaFunctions"</span><span class="p">,</span>
<span class="s">"DataFrameStatFunctions"</span><span class="p">]</span>
<span class="k">def</span> <span class="nf">_create_column_from_literal</span><span class="p">(</span><span class="n">literal</span><span class="p">):</span>
<span class="n">sc</span> <span class="o">=</span> <span class="n">SparkContext</span><span class="o">.</span><span class="n">_active_spark_context</span>
<span class="k">return</span> <span class="n">sc</span><span class="o">.</span><span class="n">_jvm</span><span class="o">.</span><span class="n">functions</span><span class="o">.</span><span class="n">lit</span><span class="p">(</span><span class="n">literal</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">_create_column_from_name</span><span class="p">(</span><span class="n">name</span><span class="p">):</span>
<span class="n">sc</span> <span class="o">=</span> <span class="n">SparkContext</span><span class="o">.</span><span class="n">_active_spark_context</span>
<span class="k">return</span> <span class="n">sc</span><span class="o">.</span><span class="n">_jvm</span><span class="o">.</span><span class="n">functions</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">_to_java_column</span><span class="p">(</span><span class="n">col</span><span class="p">):</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">col</span><span class="p">,</span> <span class="n">Column</span><span class="p">):</span>
<span class="n">jcol</span> <span class="o">=</span> <span class="n">col</span><span class="o">.</span><span class="n">_jc</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">jcol</span> <span class="o">=</span> <span class="n">_create_column_from_name</span><span class="p">(</span><span class="n">col</span><span class="p">)</span>
<span class="k">return</span> <span class="n">jcol</span>
<span class="k">def</span> <span class="nf">_to_seq</span><span class="p">(</span><span class="n">sc</span><span class="p">,</span> <span class="n">cols</span><span class="p">,</span> <span class="n">converter</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Convert a list of Column (or names) into a JVM Seq of Column.</span>
<span class="sd"> An optional `converter` could be used to convert items in `cols`</span>
<span class="sd"> into JVM Column objects.</span>
<span class="sd"> """</span>
<span class="k">if</span> <span class="n">converter</span><span class="p">:</span>
<span class="n">cols</span> <span class="o">=</span> <span class="p">[</span><span class="n">converter</span><span class="p">(</span><span class="n">c</span><span class="p">)</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">cols</span><span class="p">]</span>
<span class="k">return</span> <span class="n">sc</span><span class="o">.</span><span class="n">_jvm</span><span class="o">.</span><span class="n">PythonUtils</span><span class="o">.</span><span class="n">toSeq</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">_unary_op</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">doc</span><span class="o">=</span><span class="s">"unary operator"</span><span class="p">):</span>
<span class="sd">""" Create a method for given unary operator """</span>
<span class="k">def</span> <span class="nf">_</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">jc</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="p">,</span> <span class="n">name</span><span class="p">)()</span>
<span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">jc</span><span class="p">)</span>
<span class="n">_</span><span class="o">.</span><span class="n">__doc__</span> <span class="o">=</span> <span class="n">doc</span>
<span class="k">return</span> <span class="n">_</span>
<span class="k">def</span> <span class="nf">_func_op</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">doc</span><span class="o">=</span><span class="s">''</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">_</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">sc</span> <span class="o">=</span> <span class="n">SparkContext</span><span class="o">.</span><span class="n">_active_spark_context</span>
<span class="n">jc</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">sc</span><span class="o">.</span><span class="n">_jvm</span><span class="o">.</span><span class="n">functions</span><span class="p">,</span> <span class="n">name</span><span class="p">)(</span><span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="p">)</span>
<span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">jc</span><span class="p">)</span>
<span class="n">_</span><span class="o">.</span><span class="n">__doc__</span> <span class="o">=</span> <span class="n">doc</span>
<span class="k">return</span> <span class="n">_</span>
<span class="k">def</span> <span class="nf">_bin_op</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">doc</span><span class="o">=</span><span class="s">"binary operator"</span><span class="p">):</span>
<span class="sd">""" Create a method for given binary operator</span>
<span class="sd"> """</span>
<span class="k">def</span> <span class="nf">_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
<span class="n">jc</span> <span class="o">=</span> <span class="n">other</span><span class="o">.</span><span class="n">_jc</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">other</span>
<span class="n">njc</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="p">,</span> <span class="n">name</span><span class="p">)(</span><span class="n">jc</span><span class="p">)</span>
<span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">njc</span><span class="p">)</span>
<span class="n">_</span><span class="o">.</span><span class="n">__doc__</span> <span class="o">=</span> <span class="n">doc</span>
<span class="k">return</span> <span class="n">_</span>
<span class="k">def</span> <span class="nf">_reverse_op</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">doc</span><span class="o">=</span><span class="s">"binary operator"</span><span class="p">):</span>
<span class="sd">""" Create a method for binary operator (this object is on right side)</span>
<span class="sd"> """</span>
<span class="k">def</span> <span class="nf">_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span>
<span class="n">jother</span> <span class="o">=</span> <span class="n">_create_column_from_literal</span><span class="p">(</span><span class="n">other</span><span class="p">)</span>
<span class="n">jc</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">jother</span><span class="p">,</span> <span class="n">name</span><span class="p">)(</span><span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="p">)</span>
<span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">jc</span><span class="p">)</span>
<span class="n">_</span><span class="o">.</span><span class="n">__doc__</span> <span class="o">=</span> <span class="n">doc</span>
<span class="k">return</span> <span class="n">_</span>
<div class="viewcode-block" id="Column"><a class="viewcode-back" href="../../../pyspark.sql.html#pyspark.sql.Column">[docs]</a><span class="k">class</span> <span class="nc">Column</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> A column in a DataFrame.</span>
<span class="sd"> :class:`Column` instances can be created by::</span>
<span class="sd"> # 1. Select a column out of a DataFrame</span>
<span class="sd"> df.colName</span>
<span class="sd"> df["colName"]</span>
<span class="sd"> # 2. Create from an expression</span>
<span class="sd"> df.colName + 1</span>
<span class="sd"> 1 / df.colName</span>
<span class="sd"> .. note:: Experimental</span>
<span class="sd"> .. versionadded:: 1.3</span>
<span class="sd"> """</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">jc</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_jc</span> <span class="o">=</span> <span class="n">jc</span>
<span class="c"># arithmetic operators</span>
<span class="n">__neg__</span> <span class="o">=</span> <span class="n">_func_op</span><span class="p">(</span><span class="s">"negate"</span><span class="p">)</span>
<span class="n">__add__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"plus"</span><span class="p">)</span>
<span class="n">__sub__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"minus"</span><span class="p">)</span>
<span class="n">__mul__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"multiply"</span><span class="p">)</span>
<span class="n">__div__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"divide"</span><span class="p">)</span>
<span class="n">__truediv__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"divide"</span><span class="p">)</span>
<span class="n">__mod__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"mod"</span><span class="p">)</span>
<span class="n">__radd__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"plus"</span><span class="p">)</span>
<span class="n">__rsub__</span> <span class="o">=</span> <span class="n">_reverse_op</span><span class="p">(</span><span class="s">"minus"</span><span class="p">)</span>
<span class="n">__rmul__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"multiply"</span><span class="p">)</span>
<span class="n">__rdiv__</span> <span class="o">=</span> <span class="n">_reverse_op</span><span class="p">(</span><span class="s">"divide"</span><span class="p">)</span>
<span class="n">__rtruediv__</span> <span class="o">=</span> <span class="n">_reverse_op</span><span class="p">(</span><span class="s">"divide"</span><span class="p">)</span>
<span class="n">__rmod__</span> <span class="o">=</span> <span class="n">_reverse_op</span><span class="p">(</span><span class="s">"mod"</span><span class="p">)</span>
<span class="c"># logistic operators</span>
<span class="n">__eq__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"equalTo"</span><span class="p">)</span>
<span class="n">__ne__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"notEqual"</span><span class="p">)</span>
<span class="n">__lt__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"lt"</span><span class="p">)</span>
<span class="n">__le__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"leq"</span><span class="p">)</span>
<span class="n">__ge__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"geq"</span><span class="p">)</span>
<span class="n">__gt__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"gt"</span><span class="p">)</span>
<span class="c"># `and`, `or`, `not` cannot be overloaded in Python,</span>
<span class="c"># so use bitwise operators as boolean operators</span>
<span class="n">__and__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">'and'</span><span class="p">)</span>
<span class="n">__or__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">'or'</span><span class="p">)</span>
<span class="n">__invert__</span> <span class="o">=</span> <span class="n">_func_op</span><span class="p">(</span><span class="s">'not'</span><span class="p">)</span>
<span class="n">__rand__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"and"</span><span class="p">)</span>
<span class="n">__ror__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"or"</span><span class="p">)</span>
<span class="c"># container operators</span>
<span class="n">__contains__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"contains"</span><span class="p">)</span>
<span class="n">__getitem__</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"apply"</span><span class="p">)</span>
<span class="c"># bitwise operators</span>
<span class="n">bitwiseOR</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"bitwiseOR"</span><span class="p">)</span>
<span class="n">bitwiseAND</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"bitwiseAND"</span><span class="p">)</span>
<span class="n">bitwiseXOR</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"bitwiseXOR"</span><span class="p">)</span>
<span class="nd">@since</span><span class="p">(</span><span class="mf">1.3</span><span class="p">)</span>
<div class="viewcode-block" id="Column.getItem"><a class="viewcode-back" href="../../../pyspark.sql.html#pyspark.sql.Column.getItem">[docs]</a> <span class="k">def</span> <span class="nf">getItem</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> An expression that gets an item at position ``ordinal`` out of a list,</span>
<span class="sd"> or gets an item by key out of a dict.</span>
<span class="sd"> >>> df = sc.parallelize([([1, 2], {"key": "value"})]).toDF(["l", "d"])</span>
<span class="sd"> >>> df.select(df.l.getItem(0), df.d.getItem("key")).show()</span>
<span class="sd"> +----+------+</span>
<span class="sd"> |l[0]|d[key]|</span>
<span class="sd"> +----+------+</span>
<span class="sd"> | 1| value|</span>
<span class="sd"> +----+------+</span>
<span class="sd"> >>> df.select(df.l[0], df.d["key"]).show()</span>
<span class="sd"> +----+------+</span>
<span class="sd"> |l[0]|d[key]|</span>
<span class="sd"> +----+------+</span>
<span class="sd"> | 1| value|</span>
<span class="sd"> +----+------+</span>
<span class="sd"> """</span>
<span class="k">return</span> <span class="bp">self</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
</div>
<span class="nd">@since</span><span class="p">(</span><span class="mf">1.3</span><span class="p">)</span>
<div class="viewcode-block" id="Column.getField"><a class="viewcode-back" href="../../../pyspark.sql.html#pyspark.sql.Column.getField">[docs]</a> <span class="k">def</span> <span class="nf">getField</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="sd">"""</span>
<span class="sd"> An expression that gets a field by name in a StructField.</span>
<span class="sd"> >>> from pyspark.sql import Row</span>
<span class="sd"> >>> df = sc.parallelize([Row(r=Row(a=1, b="b"))]).toDF()</span>
<span class="sd"> >>> df.select(df.r.getField("b")).show()</span>
<span class="sd"> +----+</span>
<span class="sd"> |r[b]|</span>
<span class="sd"> +----+</span>
<span class="sd"> | b|</span>
<span class="sd"> +----+</span>
<span class="sd"> >>> df.select(df.r.a).show()</span>
<span class="sd"> +----+</span>
<span class="sd"> |r[a]|</span>
<span class="sd"> +----+</span>
<span class="sd"> | 1|</span>
<span class="sd"> +----+</span>
<span class="sd"> """</span>
<span class="k">return</span> <span class="bp">self</span><span class="p">[</span><span class="n">name</span><span class="p">]</span>
</div>
<span class="k">def</span> <span class="nf">__getattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">):</span>
<span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s">"__"</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">AttributeError</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">getField</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
<span class="c"># string methods</span>
<span class="n">rlike</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"rlike"</span><span class="p">)</span>
<span class="n">like</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"like"</span><span class="p">)</span>
<span class="n">startswith</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"startsWith"</span><span class="p">)</span>
<span class="n">endswith</span> <span class="o">=</span> <span class="n">_bin_op</span><span class="p">(</span><span class="s">"endsWith"</span><span class="p">)</span>
<span class="nd">@ignore_unicode_prefix</span>
<span class="nd">@since</span><span class="p">(</span><span class="mf">1.3</span><span class="p">)</span>
<div class="viewcode-block" id="Column.substr"><a class="viewcode-back" href="../../../pyspark.sql.html#pyspark.sql.Column.substr">[docs]</a> <span class="k">def</span> <span class="nf">substr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">startPos</span><span class="p">,</span> <span class="n">length</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Return a :class:`Column` which is a substring of the column.</span>
<span class="sd"> :param startPos: start position (int or Column)</span>
<span class="sd"> :param length: length of the substring (int or Column)</span>
<span class="sd"> >>> df.select(df.name.substr(1, 3).alias("col")).collect()</span>
<span class="sd"> [Row(col=u'Ali'), Row(col=u'Bob')]</span>
<span class="sd"> """</span>
<span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="n">startPos</span><span class="p">)</span> <span class="o">!=</span> <span class="nb">type</span><span class="p">(</span><span class="n">length</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">"Can not mix the type"</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">startPos</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span> <span class="nb">long</span><span class="p">)):</span>
<span class="n">jc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="o">.</span><span class="n">substr</span><span class="p">(</span><span class="n">startPos</span><span class="p">,</span> <span class="n">length</span><span class="p">)</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">startPos</span><span class="p">,</span> <span class="n">Column</span><span class="p">):</span>
<span class="n">jc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="o">.</span><span class="n">substr</span><span class="p">(</span><span class="n">startPos</span><span class="o">.</span><span class="n">_jc</span><span class="p">,</span> <span class="n">length</span><span class="o">.</span><span class="n">_jc</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">"Unexpected type: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="nb">type</span><span class="p">(</span><span class="n">startPos</span><span class="p">))</span>
<span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">jc</span><span class="p">)</span>
</div>
<span class="n">__getslice__</span> <span class="o">=</span> <span class="n">substr</span>
<span class="nd">@ignore_unicode_prefix</span>
<span class="nd">@since</span><span class="p">(</span><span class="mf">1.3</span><span class="p">)</span>
<div class="viewcode-block" id="Column.inSet"><a class="viewcode-back" href="../../../pyspark.sql.html#pyspark.sql.Column.inSet">[docs]</a> <span class="k">def</span> <span class="nf">inSet</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> A boolean expression that is evaluated to true if the value of this</span>
<span class="sd"> expression is contained by the evaluated values of the arguments.</span>
<span class="sd"> >>> df[df.name.inSet("Bob", "Mike")].collect()</span>
<span class="sd"> [Row(age=5, name=u'Bob')]</span>
<span class="sd"> >>> df[df.age.inSet([1, 2, 3])].collect()</span>
<span class="sd"> [Row(age=2, name=u'Alice')]</span>
<span class="sd"> .. note:: Deprecated in 1.5, use :func:`Column.isin` instead.</span>
<span class="sd"> """</span>
<span class="n">warnings</span><span class="o">.</span><span class="n">warn</span><span class="p">(</span><span class="s">"inSet is deprecated. Use isin() instead."</span><span class="p">)</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">isin</span><span class="p">(</span><span class="o">*</span><span class="n">cols</span><span class="p">)</span>
</div>
<span class="nd">@ignore_unicode_prefix</span>
<span class="nd">@since</span><span class="p">(</span><span class="mf">1.5</span><span class="p">)</span>
<div class="viewcode-block" id="Column.isin"><a class="viewcode-back" href="../../../pyspark.sql.html#pyspark.sql.Column.isin">[docs]</a> <span class="k">def</span> <span class="nf">isin</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> A boolean expression that is evaluated to true if the value of this</span>
<span class="sd"> expression is contained by the evaluated values of the arguments.</span>
<span class="sd"> >>> df[df.name.isin("Bob", "Mike")].collect()</span>
<span class="sd"> [Row(age=5, name=u'Bob')]</span>
<span class="sd"> >>> df[df.age.isin([1, 2, 3])].collect()</span>
<span class="sd"> [Row(age=2, name=u'Alice')]</span>
<span class="sd"> """</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">cols</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span> <span class="nb">set</span><span class="p">)):</span>
<span class="n">cols</span> <span class="o">=</span> <span class="n">cols</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="n">cols</span> <span class="o">=</span> <span class="p">[</span><span class="n">c</span><span class="o">.</span><span class="n">_jc</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">_create_column_from_literal</span><span class="p">(</span><span class="n">c</span><span class="p">)</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">cols</span><span class="p">]</span>
<span class="n">sc</span> <span class="o">=</span> <span class="n">SparkContext</span><span class="o">.</span><span class="n">_active_spark_context</span>
<span class="n">jc</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="p">,</span> <span class="s">"isin"</span><span class="p">)(</span><span class="n">_to_seq</span><span class="p">(</span><span class="n">sc</span><span class="p">,</span> <span class="n">cols</span><span class="p">))</span>
<span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">jc</span><span class="p">)</span>
<span class="c"># order</span></div>
<span class="n">asc</span> <span class="o">=</span> <span class="n">_unary_op</span><span class="p">(</span><span class="s">"asc"</span><span class="p">,</span> <span class="s">"Returns a sort expression based on the"</span>
<span class="s">" ascending order of the given column name."</span><span class="p">)</span>
<span class="n">desc</span> <span class="o">=</span> <span class="n">_unary_op</span><span class="p">(</span><span class="s">"desc"</span><span class="p">,</span> <span class="s">"Returns a sort expression based on the"</span>
<span class="s">" descending order of the given column name."</span><span class="p">)</span>
<span class="n">isNull</span> <span class="o">=</span> <span class="n">_unary_op</span><span class="p">(</span><span class="s">"isNull"</span><span class="p">,</span> <span class="s">"True if the current expression is null."</span><span class="p">)</span>
<span class="n">isNotNull</span> <span class="o">=</span> <span class="n">_unary_op</span><span class="p">(</span><span class="s">"isNotNull"</span><span class="p">,</span> <span class="s">"True if the current expression is not null."</span><span class="p">)</span>
<span class="nd">@since</span><span class="p">(</span><span class="mf">1.3</span><span class="p">)</span>
<div class="viewcode-block" id="Column.alias"><a class="viewcode-back" href="../../../pyspark.sql.html#pyspark.sql.Column.alias">[docs]</a> <span class="k">def</span> <span class="nf">alias</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">alias</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Returns this column aliased with a new name or names (in the case of expressions that</span>
<span class="sd"> return more than one column, such as explode).</span>
<span class="sd"> >>> df.select(df.age.alias("age2")).collect()</span>
<span class="sd"> [Row(age2=2), Row(age2=5)]</span>
<span class="sd"> """</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">alias</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="p">,</span> <span class="s">"as"</span><span class="p">)(</span><span class="n">alias</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="n">sc</span> <span class="o">=</span> <span class="n">SparkContext</span><span class="o">.</span><span class="n">_active_spark_context</span>
<span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="p">,</span> <span class="s">"as"</span><span class="p">)(</span><span class="n">_to_seq</span><span class="p">(</span><span class="n">sc</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">alias</span><span class="p">))))</span>
</div>
<span class="nd">@ignore_unicode_prefix</span>
<span class="nd">@since</span><span class="p">(</span><span class="mf">1.3</span><span class="p">)</span>
<div class="viewcode-block" id="Column.cast"><a class="viewcode-back" href="../../../pyspark.sql.html#pyspark.sql.Column.cast">[docs]</a> <span class="k">def</span> <span class="nf">cast</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dataType</span><span class="p">):</span>
<span class="sd">""" Convert the column into type ``dataType``.</span>
<span class="sd"> >>> df.select(df.age.cast("string").alias('ages')).collect()</span>
<span class="sd"> [Row(ages=u'2'), Row(ages=u'5')]</span>
<span class="sd"> >>> df.select(df.age.cast(StringType()).alias('ages')).collect()</span>
<span class="sd"> [Row(ages=u'2'), Row(ages=u'5')]</span>
<span class="sd"> """</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dataType</span><span class="p">,</span> <span class="nb">basestring</span><span class="p">):</span>
<span class="n">jc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">dataType</span><span class="p">)</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dataType</span><span class="p">,</span> <span class="n">DataType</span><span class="p">):</span>
<span class="n">sc</span> <span class="o">=</span> <span class="n">SparkContext</span><span class="o">.</span><span class="n">_active_spark_context</span>
<span class="n">ssql_ctx</span> <span class="o">=</span> <span class="n">sc</span><span class="o">.</span><span class="n">_jvm</span><span class="o">.</span><span class="n">SQLContext</span><span class="p">(</span><span class="n">sc</span><span class="o">.</span><span class="n">_jsc</span><span class="o">.</span><span class="n">sc</span><span class="p">())</span>
<span class="n">jdt</span> <span class="o">=</span> <span class="n">ssql_ctx</span><span class="o">.</span><span class="n">parseDataType</span><span class="p">(</span><span class="n">dataType</span><span class="o">.</span><span class="n">json</span><span class="p">())</span>
<span class="n">jc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">jdt</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">"unexpected type: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="nb">type</span><span class="p">(</span><span class="n">dataType</span><span class="p">))</span>
<span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">jc</span><span class="p">)</span>
</div>
<span class="n">astype</span> <span class="o">=</span> <span class="n">cast</span>
<span class="nd">@since</span><span class="p">(</span><span class="mf">1.3</span><span class="p">)</span>
<div class="viewcode-block" id="Column.between"><a class="viewcode-back" href="../../../pyspark.sql.html#pyspark.sql.Column.between">[docs]</a> <span class="k">def</span> <span class="nf">between</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">lowerBound</span><span class="p">,</span> <span class="n">upperBound</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> A boolean expression that is evaluated to true if the value of this</span>
<span class="sd"> expression is between the given columns.</span>
<span class="sd"> >>> df.select(df.name, df.age.between(2, 4)).show()</span>
<span class="sd"> +-----+--------------------------+</span>
<span class="sd"> | name|((age >= 2) && (age <= 4))|</span>
<span class="sd"> +-----+--------------------------+</span>
<span class="sd"> |Alice| true|</span>
<span class="sd"> | Bob| false|</span>
<span class="sd"> +-----+--------------------------+</span>
<span class="sd"> """</span>
<span class="k">return</span> <span class="p">(</span><span class="bp">self</span> <span class="o">>=</span> <span class="n">lowerBound</span><span class="p">)</span> <span class="o">&</span> <span class="p">(</span><span class="bp">self</span> <span class="o"><=</span> <span class="n">upperBound</span><span class="p">)</span>
</div>
<span class="nd">@since</span><span class="p">(</span><span class="mf">1.4</span><span class="p">)</span>
<div class="viewcode-block" id="Column.when"><a class="viewcode-back" href="../../../pyspark.sql.html#pyspark.sql.Column.when">[docs]</a> <span class="k">def</span> <span class="nf">when</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">condition</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Evaluates a list of conditions and returns one of multiple possible result expressions.</span>
<span class="sd"> If :func:`Column.otherwise` is not invoked, None is returned for unmatched conditions.</span>
<span class="sd"> See :func:`pyspark.sql.functions.when` for example usage.</span>
<span class="sd"> :param condition: a boolean :class:`Column` expression.</span>
<span class="sd"> :param value: a literal value, or a :class:`Column` expression.</span>
<span class="sd"> >>> from pyspark.sql import functions as F</span>
<span class="sd"> >>> df.select(df.name, F.when(df.age > 4, 1).when(df.age < 3, -1).otherwise(0)).show()</span>
<span class="sd"> +-----+--------------------------------------------------------+</span>
<span class="sd"> | name|CASE WHEN (age > 4) THEN 1 WHEN (age < 3) THEN -1 ELSE 0|</span>
<span class="sd"> +-----+--------------------------------------------------------+</span>
<span class="sd"> |Alice| -1|</span>
<span class="sd"> | Bob| 1|</span>
<span class="sd"> +-----+--------------------------------------------------------+</span>
<span class="sd"> """</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">Column</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">"condition should be a Column"</span><span class="p">)</span>
<span class="n">v</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">_jc</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">value</span>
<span class="n">jc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="o">.</span><span class="n">when</span><span class="p">(</span><span class="n">condition</span><span class="o">.</span><span class="n">_jc</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span>
<span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">jc</span><span class="p">)</span>
</div>
<span class="nd">@since</span><span class="p">(</span><span class="mf">1.4</span><span class="p">)</span>
<div class="viewcode-block" id="Column.otherwise"><a class="viewcode-back" href="../../../pyspark.sql.html#pyspark.sql.Column.otherwise">[docs]</a> <span class="k">def</span> <span class="nf">otherwise</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Evaluates a list of conditions and returns one of multiple possible result expressions.</span>
<span class="sd"> If :func:`Column.otherwise` is not invoked, None is returned for unmatched conditions.</span>
<span class="sd"> See :func:`pyspark.sql.functions.when` for example usage.</span>
<span class="sd"> :param value: a literal value, or a :class:`Column` expression.</span>
<span class="sd"> >>> from pyspark.sql import functions as F</span>
<span class="sd"> >>> df.select(df.name, F.when(df.age > 3, 1).otherwise(0)).show()</span>
<span class="sd"> +-----+---------------------------------+</span>
<span class="sd"> | name|CASE WHEN (age > 3) THEN 1 ELSE 0|</span>
<span class="sd"> +-----+---------------------------------+</span>
<span class="sd"> |Alice| 0|</span>
<span class="sd"> | Bob| 1|</span>
<span class="sd"> +-----+---------------------------------+</span>
<span class="sd"> """</span>
<span class="n">v</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">_jc</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">value</span>
<span class="n">jc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="o">.</span><span class="n">otherwise</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
<span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">jc</span><span class="p">)</span>
</div>
<span class="nd">@since</span><span class="p">(</span><span class="mf">1.4</span><span class="p">)</span>
<div class="viewcode-block" id="Column.over"><a class="viewcode-back" href="../../../pyspark.sql.html#pyspark.sql.Column.over">[docs]</a> <span class="k">def</span> <span class="nf">over</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">window</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Define a windowing column.</span>
<span class="sd"> :param window: a :class:`WindowSpec`</span>
<span class="sd"> :return: a Column</span>
<span class="sd"> >>> from pyspark.sql import Window</span>
<span class="sd"> >>> window = Window.partitionBy("name").orderBy("age").rowsBetween(-1, 1)</span>
<span class="sd"> >>> from pyspark.sql.functions import rank, min</span>
<span class="sd"> >>> # df.select(rank().over(window), min('age').over(window))</span>
<span class="sd"> .. note:: Window functions is only supported with HiveContext in 1.4</span>
<span class="sd"> """</span>
<span class="kn">from</span> <span class="nn">pyspark.sql.window</span> <span class="kn">import</span> <span class="n">WindowSpec</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="n">WindowSpec</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">"window should be WindowSpec"</span><span class="p">)</span>
<span class="n">jc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="o">.</span><span class="n">over</span><span class="p">(</span><span class="n">window</span><span class="o">.</span><span class="n">_jspec</span><span class="p">)</span>
<span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">jc</span><span class="p">)</span>
</div>
<span class="k">def</span> <span class="nf">__nonzero__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">"Cannot convert column into bool: please use '&' for 'and', '|' for 'or', "</span>
<span class="s">"'~' for 'not' when building DataFrame boolean expressions."</span><span class="p">)</span>
<span class="n">__bool__</span> <span class="o">=</span> <span class="n">__nonzero__</span>
<span class="k">def</span> <span class="nf">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="s">'Column<</span><span class="si">%s</span><span class="s">>'</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">_jc</span><span class="o">.</span><span class="n">toString</span><span class="p">()</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf8'</span><span class="p">)</span>
</div>
<span class="k">def</span> <span class="nf">_test</span><span class="p">():</span>
<span class="kn">import</span> <span class="nn">doctest</span>
<span class="kn">from</span> <span class="nn">pyspark.context</span> <span class="kn">import</span> <span class="n">SparkContext</span>
<span class="kn">from</span> <span class="nn">pyspark.sql</span> <span class="kn">import</span> <span class="n">SQLContext</span>
<span class="kn">import</span> <span class="nn">pyspark.sql.column</span>
<span class="n">globs</span> <span class="o">=</span> <span class="n">pyspark</span><span class="o">.</span><span class="n">sql</span><span class="o">.</span><span class="n">column</span><span class="o">.</span><span class="n">__dict__</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
<span class="n">sc</span> <span class="o">=</span> <span class="n">SparkContext</span><span class="p">(</span><span class="s">'local[4]'</span><span class="p">,</span> <span class="s">'PythonTest'</span><span class="p">)</span>
<span class="n">globs</span><span class="p">[</span><span class="s">'sc'</span><span class="p">]</span> <span class="o">=</span> <span class="n">sc</span>
<span class="n">globs</span><span class="p">[</span><span class="s">'sqlContext'</span><span class="p">]</span> <span class="o">=</span> <span class="n">SQLContext</span><span class="p">(</span><span class="n">sc</span><span class="p">)</span>
<span class="n">globs</span><span class="p">[</span><span class="s">'df'</span><span class="p">]</span> <span class="o">=</span> <span class="n">sc</span><span class="o">.</span><span class="n">parallelize</span><span class="p">([(</span><span class="mi">2</span><span class="p">,</span> <span class="s">'Alice'</span><span class="p">),</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="s">'Bob'</span><span class="p">)])</span> \
<span class="o">.</span><span class="n">toDF</span><span class="p">(</span><span class="n">StructType</span><span class="p">([</span><span class="n">StructField</span><span class="p">(</span><span class="s">'age'</span><span class="p">,</span> <span class="n">IntegerType</span><span class="p">()),</span>
<span class="n">StructField</span><span class="p">(</span><span class="s">'name'</span><span class="p">,</span> <span class="n">StringType</span><span class="p">())]))</span>
<span class="p">(</span><span class="n">failure_count</span><span class="p">,</span> <span class="n">test_count</span><span class="p">)</span> <span class="o">=</span> <span class="n">doctest</span><span class="o">.</span><span class="n">testmod</span><span class="p">(</span>
<span class="n">pyspark</span><span class="o">.</span><span class="n">sql</span><span class="o">.</span><span class="n">column</span><span class="p">,</span> <span class="n">globs</span><span class="o">=</span><span class="n">globs</span><span class="p">,</span>
<span class="n">optionflags</span><span class="o">=</span><span class="n">doctest</span><span class="o">.</span><span class="n">ELLIPSIS</span> <span class="o">|</span> <span class="n">doctest</span><span class="o">.</span><span class="n">NORMALIZE_WHITESPACE</span> <span class="o">|</span> <span class="n">doctest</span><span class="o">.</span><span class="n">REPORT_NDIFF</span><span class="p">)</span>
<span class="n">globs</span><span class="p">[</span><span class="s">'sc'</span><span class="p">]</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>
<span class="k">if</span> <span class="n">failure_count</span><span class="p">:</span>
<span class="nb">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span>
<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span>
<span class="n">_test</span><span class="p">()</span>
</pre></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../../index.html">
<img class="logo" src="../../../_static/spark-logo-hd.png" alt="Logo"/>
</a></p>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="nav-item nav-item-0"><a href="../../../index.html">PySpark master documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright .
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
</body>
</html>