<p dir="auto">This works with pandas 0.12:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from ggplot import meat
meat.get(None)
[returns None]"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">ggplot</span> <span class="pl-k">import</span> <span class="pl-s1">meat</span>
<span class="pl-s1">meat</span>.<span class="pl-en">get</span>(<span class="pl-c1">None</span>)
[<span class="pl-s1">returns</span> <span class="pl-v">None</span>]</pre></div>
<p dir="auto">But throws an error in 0.13 (RC):</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
&lt;ipython-input-11-86be6a7317b8&gt; in &lt;module&gt;()
----&gt; 1 meat.get(None)

C:\portabel\Python27\lib\site-packages\pandas\core\generic.pyc in get(self, key, default)
    961         &quot;&quot;&quot;
    962         try:
--&gt; 963             return self[key]
    964         except KeyError:
    965             return default

C:\portabel\Python27\lib\site-packages\pandas\core\frame.pyc in __getitem__(self, key)
   1626             return self._getitem_multilevel(key)
   1627         else:
-&gt; 1628             return self._getitem_column(key)
   1629 
   1630     def _getitem_column(self, key):

C:\portabel\Python27\lib\site-packages\pandas\core\frame.pyc in _getitem_column(self, key)
   1633         # get column
   1634         if self.columns.is_unique:
-&gt; 1635             return self._get_item_cache(key)
   1636 
   1637         # duplicate columns &amp; possible reduce dimensionaility

C:\portabel\Python27\lib\site-packages\pandas\core\generic.pyc in _get_item_cache(self, item)
    972         res = cache.get(item)
    973         if res is None:
--&gt; 974             values = self._data.get(item)
    975             res = self._box_item_values(item, values)
    976             cache[item] = res

C:\portabel\Python27\lib\site-packages\pandas\core\internals.pyc in get(self, item)
   2737             if isnull(item):
   2738                 indexer = np.arange(len(self.items))[isnull(self.items)]
-&gt; 2739                 return self.get_for_nan_indexer(indexer)
   2740 
   2741             _, block = self._find_block(item)

C:\portabel\Python27\lib\site-packages\pandas\core\internals.pyc in get_for_nan_indexer(self, indexer)
   2789                 indexer = indexer.item()
   2790             else:
-&gt; 2791                 raise ValueError(&quot;cannot label index with a null key&quot;)
   2792 
   2793         # take a nan indexer and return the values

ValueError: cannot label index with a null key"><pre class="notranslate"><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span>
<span class="pl-v">ValueError</span>                                <span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>)
<span class="pl-c1">&lt;</span><span class="pl-s1">ipython</span><span class="pl-c1">-</span><span class="pl-s1">input</span><span class="pl-c1">-</span><span class="pl-c1">11</span><span class="pl-c1">-</span><span class="pl-c1">86</span><span class="pl-s1">be6a7317b8</span><span class="pl-c1">&gt;</span> <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>()
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">1</span> <span class="pl-s1">meat</span>.<span class="pl-en">get</span>(<span class="pl-c1">None</span>)

<span class="pl-v">C</span>:\p<span class="pl-s1">ortabel</span>\P<span class="pl-s1">ython27</span>\l<span class="pl-s1">ib</span>\s<span class="pl-s1">ite</span><span class="pl-c1">-</span><span class="pl-s1">packages</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">eneric</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">get</span>(<span class="pl-s1">self</span>, <span class="pl-s1">key</span>, <span class="pl-s1">default</span>)
    <span class="pl-c1">961</span>         """
    962         try:
--&gt; 963             return self[key]
    964         except KeyError:
    965             return default

C:\portabel\Python27\lib\site-packages\pandas\core<span class="pl-cce">\f</span>rame.pyc in __getitem__(self, key)
   1626             return self._getitem_multilevel(key)
   1627         else:
-&gt; 1628             return self._getitem_column(key)
   1629 
   1630     def _getitem_column(self, key):

C:\portabel\Python27\lib\site-packages\pandas\core<span class="pl-cce">\f</span>rame.pyc in _getitem_column(self, key)
   1633         # get column
   1634         if self.columns.is_unique:
-&gt; 1635             return self._get_item_cache(key)
   1636 
   1637         # duplicate columns &amp; possible reduce dimensionaility

C:\portabel\Python27\lib\site-packages\pandas\core\generic.pyc in _get_item_cache(self, item)
    972         res = cache.get(item)
    973         if res is None:
--&gt; 974             values = self._data.get(item)
    975             res = self._box_item_values(item, values)
    976             cache[item] = res

C:\portabel\Python27\lib\site-packages\pandas\core\internals.pyc in get(self, item)
   2737             if isnull(item):
   2738                 indexer = np.arange(len(self.items))[isnull(self.items)]
-&gt; 2739                 return self.get_for_nan_indexer(indexer)
   2740 
   2741             _, block = self._find_block(item)

C:\portabel\Python27\lib\site-packages\pandas\core\internals.pyc in get_for_nan_indexer(self, indexer)
   2789                 indexer = indexer.item()
   2790             else:
-&gt; 2791                 raise ValueError("cannot label index with a null key")
   <span class="pl-c1">2792</span> 
   <span class="pl-c1">2793</span>         <span class="pl-c"># take a nan indexer and return the values</span>

<span class="pl-v">ValueError</span>: <span class="pl-s1">cannot</span> <span class="pl-s1">label</span> <span class="pl-s1">index</span> <span class="pl-k">with</span> <span class="pl-s1">a</span> <span class="pl-s1">null</span> <span class="pl-s1">key</span></pre></div>
<p dir="auto">Not sure if that is intentional as this broke some code in the facet_wrap in ggplot (which now will get some update against this :-) )</p>
<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; items
             item   name
store1      dress   V
store2       food   A
store2      water   C"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; items
             item   name
store1      dress   V
store2       food   A
store2      water   C
</code></pre></div>
<p dir="auto">CASE 1 : axis set to column and given a value which is not available in the structure. Gives ValueError.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; items.drop('abcd',axis=1)
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/usr/local/lib/python3.6/site-packages/pandas/core/generic.py&quot;, line 2530, in drop
    obj = obj._drop_axis(labels, axis, level=level, errors=errors)
  File &quot;/usr/local/lib/python3.6/site-packages/pandas/core/generic.py&quot;, line 2562, in _drop_axis
    new_axis = axis.drop(labels, errors=errors)
  File &quot;/usr/local/lib/python3.6/site-packages/pandas/core/indexes/base.py&quot;, line 3744, in drop
    labels[mask])
ValueError: labels ['abcd'] not contained in axis"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; items.drop('abcd',axis=1)
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/usr/local/lib/python3.6/site-packages/pandas/core/generic.py", line 2530, in drop
    obj = obj._drop_axis(labels, axis, level=level, errors=errors)
  File "/usr/local/lib/python3.6/site-packages/pandas/core/generic.py", line 2562, in _drop_axis
    new_axis = axis.drop(labels, errors=errors)
  File "/usr/local/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 3744, in drop
    labels[mask])
ValueError: labels ['abcd'] not contained in axis
</code></pre></div>
<p dir="auto">CASE 2 : axis set to row, and given a value which is not available in structure should behave in the same way as the above case does.<br>
Instead it just prints the structure table. Shouldn’t it be throwing ValueError ?</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; items.drop('abcd',axis=0)
             item   name
store1      dress   V
store2       food   A
store2      water   C
&gt;&gt;&gt; "><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; items.drop('abcd',axis=0)
             item   name
store1      dress   V
store2       food   A
store2      water   C
&gt;&gt;&gt; 
</code></pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">When provided invalid column name(axis=1) it throws "ValueError". Same happens with row as well(axis=0). But when there are duplicate indices in the DataFrame it doesn't.</p>
<h4 dir="auto">Expected Output</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; items.drop('d',axis=0)
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/usr/local/lib/python3.6/site-packages/pandas/core/generic.py&quot;, line 2530, in drop
    obj = obj._drop_axis(labels, axis, level=level, errors=errors)
  File &quot;/usr/local/lib/python3.6/site-packages/pandas/core/generic.py&quot;, line 2562, in _drop_axis
    new_axis = axis.drop(labels, errors=errors)
  File &quot;/usr/local/lib/python3.6/site-packages/pandas/core/indexes/base.py&quot;, line 3744, in drop
    labels[mask])
ValueError: labels ['d'] not contained in axis"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; items.drop('d',axis=0)
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/usr/local/lib/python3.6/site-packages/pandas/core/generic.py", line 2530, in drop
    obj = obj._drop_axis(labels, axis, level=level, errors=errors)
  File "/usr/local/lib/python3.6/site-packages/pandas/core/generic.py", line 2562, in _drop_axis
    new_axis = axis.drop(labels, errors=errors)
  File "/usr/local/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 3744, in drop
    labels[mask])
ValueError: labels ['d'] not contained in axis
</code></pre></div>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
INSTALLED VERSIONS
------------------
commit: None
python: 3.6.4.final.0
python-bits: 64
OS: Darwin
OS-release: 17.3.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_AU.UTF-8
LOCALE: en_AU.UTF-8
<p dir="auto">pandas: 0.22.0<br>
pytest: None<br>
pip: 9.0.1<br>
setuptools: 36.5.0<br>
Cython: 0.27.3<br>
numpy: 1.13.3<br>
scipy: None<br>
pyarrow: None<br>
xarray: None<br>
IPython: None<br>
sphinx: None<br>
patsy: None<br>
dateutil: 2.6.1<br>
pytz: 2017.3<br>
blosc: None<br>
bottleneck: None<br>
tables: None<br>
numexpr: None<br>
feather: None<br>
matplotlib: None<br>
openpyxl: None<br>
xlrd: None<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: None<br>
html5lib: None<br>
sqlalchemy: None<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: None<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>