<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Your code here
import sqlite3
import pandas as pd
cnx = sqlite3.connect('database.sqlite')
df = pd.read_sql_query(&quot;SELECT * FROM Player_Attributes&quot;, cnx)"><pre class="notranslate"><span class="pl-c"># Your code here</span>
<span class="pl-k">import</span> <span class="pl-s1">sqlite3</span>
<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">cnx</span> <span class="pl-c1">=</span> <span class="pl-s1">sqlite3</span>.<span class="pl-en">connect</span>(<span class="pl-s">'database.sqlite'</span>)
<span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">read_sql_query</span>(<span class="pl-s">"SELECT * FROM Player_Attributes"</span>, <span class="pl-s1">cnx</span>)</pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">pandas.io.sql.DatabaseError: Execution failed on sql 'SELECT * FROM Player_Attributes': no such table: Player_Attributes<br>
[this should explain <strong>why</strong> the current behaviour is a problem and why the expected output is a better solution.]</p>
<p dir="auto"><strong>Note</strong>: We receive a lot of issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates!</p>
<p dir="auto"><strong>Note</strong>: Many problems can be resolved by simply upgrading <code class="notranslate">pandas</code> to the latest version. Before submitting, please check if that solution works for you. If possible, you may want to check if <code class="notranslate">master</code> addresses this issue, but that is not necessary.</p>
<p dir="auto">For documentation-related issues, you can check the latest versions of the docs on <code class="notranslate">master</code> here:</p>
<p dir="auto"><a href="https://pandas-docs.github.io/pandas-docs-travis/" rel="nofollow">https://pandas-docs.github.io/pandas-docs-travis/</a></p>
<p dir="auto">If the issue has not been resolved there, go ahead and file it in the issue tracker.</p>
<h4 dir="auto">Expected Output</h4>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<p dir="auto">[paste the output of <code class="notranslate">pd.show_versions()</code> here below this line]</p>
</details>
<h4 dir="auto">Code Sample</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas as pd
import numpy as np

dates = pd.date_range('1/1/2000', periods=8)
data1 = {'A': np.arange(8), 
         'B': np.random.randn(8)
        }
df1 = pd.DataFrame(data1, index=dates)

data2 = {'A': np.arange(8),
         'C': np.random.randn(8)
        }
df2 = pd.DataFrame(data2, index=dates)

df = pd.concat([df1, df2], axis=1, ignore_index=False)"><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-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>

<span class="pl-s1">dates</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">date_range</span>(<span class="pl-s">'1/1/2000'</span>, <span class="pl-s1">periods</span><span class="pl-c1">=</span><span class="pl-c1">8</span>)
<span class="pl-s1">data1</span> <span class="pl-c1">=</span> {<span class="pl-s">'A'</span>: <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">8</span>), 
         <span class="pl-s">'B'</span>: <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">8</span>)
        }
<span class="pl-s1">df1</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">data1</span>, <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">dates</span>)

<span class="pl-s1">data2</span> <span class="pl-c1">=</span> {<span class="pl-s">'A'</span>: <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">8</span>),
         <span class="pl-s">'C'</span>: <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">8</span>)
        }
<span class="pl-s1">df2</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">data2</span>, <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">dates</span>)

<span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">concat</span>([<span class="pl-s1">df1</span>, <span class="pl-s1">df2</span>], <span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">1</span>, <span class="pl-s1">ignore_index</span><span class="pl-c1">=</span><span class="pl-c1">False</span>)</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="print(df1)
            A         B
2000-01-01  0  0.756225
2000-01-02  1  0.537196
2000-01-03  2  0.813128
2000-01-04  3  0.819868
2000-01-05  4 -0.653656
2000-01-06  5  1.246314
2000-01-07  6 -0.703276
2000-01-08  7 -0.743086"><pre class="notranslate"><code class="notranslate">print(df1)
            A         B
2000-01-01  0  0.756225
2000-01-02  1  0.537196
2000-01-03  2  0.813128
2000-01-04  3  0.819868
2000-01-05  4 -0.653656
2000-01-06  5  1.246314
2000-01-07  6 -0.703276
2000-01-08  7 -0.743086
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="print(df2)
            A         C
2000-01-01  0 -1.584052
2000-01-02  1 -0.804060
2000-01-03  2 -1.350531
2000-01-04  3 -0.762914
2000-01-05  4 -0.589009
2000-01-06  5  0.395458
2000-01-07  6 -0.124446
2000-01-08  7  0.100183"><pre class="notranslate"><code class="notranslate">print(df2)
            A         C
2000-01-01  0 -1.584052
2000-01-02  1 -0.804060
2000-01-03  2 -1.350531
2000-01-04  3 -0.762914
2000-01-05  4 -0.589009
2000-01-06  5  0.395458
2000-01-07  6 -0.124446
2000-01-08  7  0.100183
</code></pre></div>
<p dir="auto">df1 and df2 both contain column A (which is not an index column), so the unique column names are:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="print(df.columns.unique())
['A' 'B' 'C']"><pre class="notranslate"><code class="notranslate">print(df.columns.unique())
['A' 'B' 'C']
</code></pre></div>
<p dir="auto">When applying the below selection (assuming that columns with the same name contain the same values - which I know is true in this use case however may not always be true), the duplicate columns are kept.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="print(df[df.columns.unique()])
            A  A         B         C
2000-01-01  0  0  0.086386 -2.558181
2000-01-02  1  1  0.217020 -0.964484
2000-01-03  2  2 -0.426538 -0.579129
2000-01-04  3  3  0.620989 -1.908091
2000-01-05  4  4 -1.463473 -0.345109
2000-01-06  5  5 -0.460185  0.670077
2000-01-07  6  6 -1.353535  0.226513
2000-01-08  7  7  0.329263  2.274627"><pre class="notranslate"><code class="notranslate">print(df[df.columns.unique()])
            A  A         B         C
2000-01-01  0  0  0.086386 -2.558181
2000-01-02  1  1  0.217020 -0.964484
2000-01-03  2  2 -0.426538 -0.579129
2000-01-04  3  3  0.620989 -1.908091
2000-01-05  4  4 -1.463473 -0.345109
2000-01-06  5  5 -0.460185  0.670077
2000-01-07  6  6 -1.353535  0.226513
2000-01-08  7  7  0.329263  2.274627
</code></pre></div>
<h4 dir="auto">Expected Output</h4>
<p dir="auto">A drop_duplicates for columns where for example the first duplicate column name is kept.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="print(df.T.drop_duplicates().T)
              A         B         C
2000-01-01  0.0  0.086386 -2.558181
2000-01-02  1.0  0.217020 -0.964484
2000-01-03  2.0 -0.426538 -0.579129
2000-01-04  3.0  0.620989 -1.908091
2000-01-05  4.0 -1.463473 -0.345109
2000-01-06  5.0 -0.460185  0.670077
2000-01-07  6.0 -1.353535  0.226513
2000-01-08  7.0  0.329263  2.274627"><pre class="notranslate"><code class="notranslate">print(df.T.drop_duplicates().T)
              A         B         C
2000-01-01  0.0  0.086386 -2.558181
2000-01-02  1.0  0.217020 -0.964484
2000-01-03  2.0 -0.426538 -0.579129
2000-01-04  3.0  0.620989 -1.908091
2000-01-05  4.0 -1.463473 -0.345109
2000-01-06  5.0 -0.460185  0.670077
2000-01-07  6.0 -1.353535  0.226513
2000-01-08  7.0  0.329263  2.274627
</code></pre></div>
<h4 dir="auto">output of <code class="notranslate">pd.show_versions()</code></h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="INSTALLED VERSIONS
------------------
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Linux
OS-release: 3.19.0-59-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_AU.UTF-8

pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 23.0.0
Cython: 0.24
numpy: 1.11.1
scipy: 0.17.1
statsmodels: None
xarray: None
IPython: 5.0.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.12
pymysql: 0.7.3.None
psycopg2: 2.6.1 (dt dec pq3 ext)
jinja2: 2.8
boto: None
pandas_datareader: None"><pre class="notranslate"><code class="notranslate">INSTALLED VERSIONS
------------------
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Linux
OS-release: 3.19.0-59-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_AU.UTF-8

pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 23.0.0
Cython: 0.24
numpy: 1.11.1
scipy: 0.17.1
statsmodels: None
xarray: None
IPython: 5.0.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.12
pymysql: 0.7.3.None
psycopg2: 2.6.1 (dt dec pq3 ext)
jinja2: 2.8
boto: None
pandas_datareader: None
</code></pre></div>