<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas as pd

dat = pd.DataFrame([
    {'a':1,'b':2,'c':3},
    {'a':1,'b':2,'c':3}
])

dat.drop_duplicates(subset=['a','d'])"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>

<span class="pl-s1">dat</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>([
    {<span class="pl-s">'a'</span>:<span class="pl-c1">1</span>,<span class="pl-s">'b'</span>:<span class="pl-c1">2</span>,<span class="pl-s">'c'</span>:<span class="pl-c1">3</span>},
    {<span class="pl-s">'a'</span>:<span class="pl-c1">1</span>,<span class="pl-s">'b'</span>:<span class="pl-c1">2</span>,<span class="pl-s">'c'</span>:<span class="pl-c1">3</span>}
])

<span class="pl-s1">dat</span>.<span class="pl-en">drop_duplicates</span>(<span class="pl-s1">subset</span><span class="pl-c1">=</span>[<span class="pl-s">'a'</span>,<span class="pl-s">'d'</span>])</pre></div>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="	a	b	c
0	1	2	3
"><pre class="notranslate">	<span class="pl-s1">a</span>	<span class="pl-s1">b</span>	<span class="pl-s1">c</span>
<span class="pl-c1">0</span>	<span class="pl-c1">1</span>	<span class="pl-c1">2</span>	<span class="pl-c1">3</span></pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">When using <code class="notranslate">drop_duplicates()</code> with the <code class="notranslate">subset</code> option, a warning should probably be raised when trying to subset on a column that doesn't exist.</p>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 3.6.3.final.0<br>
python-bits: 64<br>
OS: Darwin<br>
OS-release: 17.5.0<br>
machine: x86_64<br>
processor: i386<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: en_US.UTF-8<br>
LOCALE: en_US.UTF-8</p>
<p dir="auto">pandas: 0.22.0<br>
pytest: 3.3.1<br>
pip: 10.0.1<br>
setuptools: 28.8.0<br>
Cython: None<br>
numpy: 1.13.3<br>
scipy: 1.0.1<br>
pyarrow: None<br>
xarray: None<br>
IPython: 6.2.1<br>
sphinx: None<br>
patsy: None<br>
dateutil: 2.6.1<br>
pytz: 2017.2<br>
blosc: None<br>
bottleneck: None<br>
tables: None<br>
numexpr: None<br>
feather: None<br>
matplotlib: 2.2.2<br>
openpyxl: None<br>
xlrd: 1.1.0<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: None<br>
html5lib: 1.0.1<br>
sqlalchemy: 1.1.15<br>
pymysql: None<br>
psycopg2: 2.7 (dt dec pq3 ext lo64)<br>
jinja2: 2.10<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>
<p dir="auto">There's a duplicate plot created when calling <code class="notranslate">Series.hist</code> as well as a duplicate plot when calling <code class="notranslate">groupby.plot</code> that I think would be fixed by resolving this issue.<br>
<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="16318826" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/4113" data-hovercard-type="pull_request" data-hovercard-url="/pandas-dev/pandas/pull/4113/hovercard" href="https://github.com/pandas-dev/pandas/pull/4113">#4113</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2344354" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/413" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/413/hovercard" href="https://github.com/pandas-dev/pandas/issues/413">#413</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="8080244" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/2168" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/2168/hovercard" href="https://github.com/pandas-dev/pandas/issues/2168">#2168</a></p>