<p dir="auto">Decide what to do with each of these</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> deprecate <code class="notranslate">from_csv</code> <del>/ change to be exactly like <code class="notranslate">read_csv</code></del> -&gt; <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="263627789" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/17812" data-hovercard-type="pull_request" data-hovercard-url="/pandas-dev/pandas/pull/17812/hovercard" href="https://github.com/pandas-dev/pandas/pull/17812">#17812</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> from_dict</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> from_records (see <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="41725189" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/8161" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/8161/hovercard" href="https://github.com/pandas-dev/pandas/issues/8161">#8161</a>)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> from_items (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="277166004" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/18529" data-hovercard-type="pull_request" data-hovercard-url="/pandas-dev/pandas/pull/18529/hovercard" href="https://github.com/pandas-dev/pandas/pull/18529">#18529</a>)</li>
</ul>
<p dir="auto">This is just a suggestion: <code class="notranslate">DataFrame</code> constructor already supports the things that <code class="notranslate">from_dict</code> and <code class="notranslate">from_records</code> do (<code class="notranslate">from_items</code> is not supported by the constructor, but maybe it should be?). Also <code class="notranslate">from_csv</code> does the same thing as <code class="notranslate">pd.read_csv</code>.</p>
<p dir="auto">Since <code class="notranslate">There should be one-- and preferably only one --obvious way to do it.</code> maybe these methods should be removed/deprecated?</p>
<p dir="auto">I know that this would cause backward incompatibility, so maybe just a deprecation warning could be displayed until a future major release that could remove them.</p>
<h4 dir="auto">Problem description</h4>
<p dir="auto">I was looking into how to convert dataframes to numpy arrays so that both column dtypes and names would be retained, preferably in an efficient way so that memory is not duplicated while doing this. In some way, I would like to have a view on internal data already stored by dataframes as a numpy array. I am good with all datatypes already used in dataframe, and names there.</p>
<p dir="auto">The issue is that both <code class="notranslate">as_matrix</code> and <code class="notranslate">values</code> convert dtypes of all values. And <code class="notranslate">to_records</code> does not create a simple numpy array.</p>
<p dir="auto">I have found two potential StackOverflow answers:</p>
<ul dir="auto">
<li><a href="https://stackoverflow.com/questions/40554179/how-to-keep-column-names-when-converting-from-pandas-to-numpy" rel="nofollow">https://stackoverflow.com/questions/40554179/how-to-keep-column-names-when-converting-from-pandas-to-numpy</a></li>
<li><a href="https://stackoverflow.com/questions/13187778/convert-pandas-dataframe-to-numpy-array-preserving-index" rel="nofollow">https://stackoverflow.com/questions/13187778/convert-pandas-dataframe-to-numpy-array-preserving-index</a></li>
</ul>
<p dir="auto">But it seems to me that all those solutions copy data around through intermediate data structures, and then just store them into a new numpy array.</p>
<p dir="auto">So I would ask for a way to get data as it is, without any conversions of dtypes, as a numpy array.</p>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
INSTALLED VERSIONS
------------------
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Linux
OS-release: 4.9.27-moby
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
<p dir="auto">pandas: 0.20.1<br>
pytest: None<br>
pip: 9.0.1<br>
setuptools: 20.7.0<br>
Cython: 0.25.2<br>
numpy: 1.12.1<br>
scipy: 0.19.0<br>
xarray: None<br>
IPython: None<br>
sphinx: None<br>
patsy: None<br>
dateutil: 2.6.0<br>
pytz: 2017.2<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>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>