<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<p dir="auto"><a href="http://stackoverflow.com/questions/39129419/why-does-dataframe-construction-break-python-on-numpy-empty-like" rel="nofollow">http://stackoverflow.com/questions/39129419/why-does-dataframe-construction-break-python-on-numpy-empty-like</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import numpy as np
import pandas as pd

a = np.array([None, None], dtype=object)
print(a)      # [None None]

dfa = pd.DataFrame(a)
print(dfa)

#      0
#0  None
#1  None

b = np.empty_like(a)
print(b)

#[None None]

(a == b).all()

#True

dfb = pd.DataFrame(b)  # Fine so far
print(dfb.values)

#[[None]
 #[None]]

print(dfb)  #Crash"><pre class="notranslate"><code class="notranslate">import numpy as np
import pandas as pd

a = np.array([None, None], dtype=object)
print(a)      # [None None]

dfa = pd.DataFrame(a)
print(dfa)

#      0
#0  None
#1  None

b = np.empty_like(a)
print(b)

#[None None]

(a == b).all()

#True

dfb = pd.DataFrame(b)  # Fine so far
print(dfb.values)

#[[None]
 #[None]]

print(dfb)  #Crash
</code></pre></div>
<h4 dir="auto">Expected Output</h4>
<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.1.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 18.2
Cython: None
numpy: 1.11.1
scipy: 0.17.1
statsmodels: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.5.0
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: None"><pre class="notranslate"><code class="notranslate">INSTALLED VERSIONS
------------------
commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 18.2
Cython: None
numpy: 1.11.1
scipy: 0.17.1
statsmodels: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.5.0
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: None
</code></pre></div>
<p dir="auto">This code segfaults:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
import pandas as pd
df = pd.DataFrame(np.random.randn(3, 3), index='A B C'.split())
pd.DataFrame(np.empty_like(df.index))"><pre class="notranslate"><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-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">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">3</span>, <span class="pl-c1">3</span>), <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s">'A B C'</span>.<span class="pl-en">split</span>())
<span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">np</span>.<span class="pl-en">empty_like</span>(<span class="pl-s1">df</span>.<span class="pl-s1">index</span>))</pre></div>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 3.5.2.final.0<br>
python-bits: 64<br>
OS: Linux<br>
OS-release: 3.13.0-91-generic<br>
machine: x86_64<br>
processor: x86_64<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: en_US.UTF-8</p>
<p dir="auto">pandas: 0.18.1<br>
nose: 1.3.7<br>
pip: 8.1.2<br>
setuptools: 23.0.0<br>
Cython: 0.24<br>
numpy: 1.11.1<br>
scipy: 0.17.1<br>
statsmodels: 0.6.1<br>
xarray: 0.7.2<br>
IPython: 5.0.0<br>
sphinx: None<br>
patsy: 0.4.1<br>
dateutil: 2.3<br>
pytz: 2016.4<br>
blosc: None<br>
bottleneck: 1.1.0<br>
tables: 3.2.2<br>
numexpr: 2.6.0<br>
matplotlib: 1.5.1<br>
openpyxl: None<br>
xlrd: None<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: 4.4.1<br>
html5lib: 0.999<br>
httplib2: None<br>
apiclient: None<br>
sqlalchemy: None<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.8<br>
boto: None<br>
pandas_datareader: None</p>