@@ -4232,7 +4232,55 @@ def as_matrix(self, columns=None):
42324232
42334233 @property
42344234 def values (self ):
4235- """Numpy representation of NDFrame
4235+ """
4236+ Return a Numpy representation of the DataFrame.
4237+
4238+ Only the values in the DataFrame will be returned, the axes labels
4239+ will be removed.
4240+
4241+ Returns
4242+ -------
4243+ numpy.ndarray
4244+ The values of the DataFrame.
4245+
4246+ Examples
4247+ --------
4248+ A DataFrame where all columns are the same type (e.g., int64) results
4249+ in an array of the same type.
4250+
4251+ >>> df = pd.DataFrame({'age': [ 3, 29],
4252+ ... 'height': [94, 170],
4253+ ... 'weight': [31, 115]})
4254+ >>> df
4255+ age height weight
4256+ 0 3 94 31
4257+ 1 29 170 115
4258+ >>> df.dtypes
4259+ age int64
4260+ height int64
4261+ weight int64
4262+ dtype: object
4263+ >>> df.values
4264+ array([[ 3, 94, 31],
4265+ [ 29, 170, 115]], dtype=int64)
4266+
4267+ A DataFrame with mixed type columns(e.g., str/object, int64, float32)
4268+ results in an ndarray of the broadest type that accommodates these
4269+ mixed types (e.g., object).
4270+
4271+ >>> df2 = pd.DataFrame([('parrot', 24.0, 'second'),
4272+ ... ('lion', 80.5, 1),
4273+ ... ('monkey', np.nan, None)],
4274+ ... columns=('name', 'max_speed', 'rank'))
4275+ >>> df2.dtypes
4276+ name object
4277+ max_speed float64
4278+ rank object
4279+ dtype: object
4280+ >>> df2.values
4281+ array([['parrot', 24.0, 'second'],
4282+ ['lion', 80.5, 1],
4283+ ['monkey', nan, None]], dtype=object)
42364284
42374285 Notes
42384286 -----
@@ -4243,8 +4291,13 @@ def values(self):
42434291
42444292 e.g. If the dtypes are float16 and float32, dtype will be upcast to
42454293 float32. If dtypes are int32 and uint8, dtype will be upcast to
4246- int32. By numpy.find_common_type convention, mixing int64 and uint64
4247- will result in a flot64 dtype.
4294+ int32. By :func:`numpy.find_common_type` convention, mixing int64
4295+ and uint64 will result in a float64 dtype.
4296+
4297+ See Also
4298+ --------
4299+ pandas.DataFrame.index : Retrievie the index labels
4300+ pandas.DataFrame.columns : Retrieving the column names
42484301 """
42494302 self ._consolidate_inplace ()
42504303 return self ._data .as_array (transpose = self ._AXIS_REVERSED )
0 commit comments