W3cubDocs

/pandas 0.25

pandas.DataFrame.get_values

DataFrame.get_values(self) [source]

Return an ndarray after converting sparse values to dense.

Deprecated since version 0.25.0: Use np.asarray(..) or DataFrame.values() instead.

This is the same as .values for non-sparse data. For sparse data contained in a SparseArray, the data are first converted to a dense representation.

Returns:
numpy.ndarray

Numpy representation of DataFrame.

See also

values
Numpy representation of DataFrame.
SparseArray
Container for sparse data.

Examples

>>> df = pd.DataFrame({'a': [1, 2], 'b': [True, False],
...                    'c': [1.0, 2.0]})
>>> df
   a      b    c
0  1   True  1.0
1  2  False  2.0
>>> df.get_values()
array([[1, True, 1.0], [2, False, 2.0]], dtype=object)
>>> df = pd.DataFrame({"a": pd.SparseArray([1, None, None]),
...                    "c": [1.0, 2.0, 3.0]})
>>> df
     a    c
0  1.0  1.0
1  NaN  2.0
2  NaN  3.0
>>> df.get_values()
array([[ 1.,  1.],
       [nan,  2.],
       [nan,  3.]])

© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.DataFrame.get_values.html