def astype(self, dtype: Union[(str, Dtype, Dict[(Name, Union[(str, Dtype)])])]) -> 'DataFrame':
    "\n        Cast a pandas-on-Spark object to a specified dtype ``dtype``.\n\n        Parameters\n        ----------\n        dtype : data type, or dict of column name -> data type\n            Use a numpy.dtype or Python type to cast entire pandas-on-Spark object to\n            the same type. Alternatively, use {col: dtype, ...}, where col is a\n            column label and dtype is a numpy.dtype or Python type to cast one\n            or more of the DataFrame's columns to column-specific types.\n\n        Returns\n        -------\n        casted : same type as caller\n\n        See Also\n        --------\n        to_datetime : Convert argument to datetime.\n\n        Examples\n        --------\n        >>> df = ps.DataFrame({'a': [1, 2, 3], 'b': [1, 2, 3]}, dtype='int64')\n        >>> df\n           a  b\n        0  1  1\n        1  2  2\n        2  3  3\n\n        Convert to float type:\n\n        >>> df.astype('float')\n             a    b\n        0  1.0  1.0\n        1  2.0  2.0\n        2  3.0  3.0\n\n        Convert to int64 type back:\n\n        >>> df.astype('int64')\n           a  b\n        0  1  1\n        1  2  2\n        2  3  3\n\n        Convert column a to float type:\n\n        >>> df.astype({'a': float})\n             a  b\n        0  1.0  1\n        1  2.0  2\n        2  3.0  3\n\n        "
    applied = []
    if is_dict_like(dtype):
        dtype_dict = cast(Dict[(Name, Union[(str, Dtype)])], dtype)
        for col_name in dtype_dict.keys():
            if (col_name not in self.columns):
                raise KeyError('Only a column name can be used for the key in a dtype mappings argument.')
        for (col_name, col) in self.items():
            if (col_name in dtype_dict):
                applied.append(col.astype(dtype=dtype_dict[col_name]))
            else:
                applied.append(col)
    else:
        for (col_name, col) in self.items():
            applied.append(col.astype(dtype=cast(Union[(str, Dtype)], dtype)))
    return DataFrame(self._internal.with_new_columns(applied))
Cast a pandas-on-Spark object to a specified dtype ``dtype``.

Parameters
----------
dtype : data type, or dict of column name -> data type
    Use a numpy.dtype or Python type to cast entire pandas-on-Spark object to
    the same type. Alternatively, use {col: dtype, ...}, where col is a
    column label and dtype is a numpy.dtype or Python type to cast one
    or more of the DataFrame's columns to column-specific types.

Returns
-------
casted : same type as caller

See Also
--------
to_datetime : Convert argument to datetime.

Examples
--------
>>> df = ps.DataFrame({'a': [1, 2, 3], 'b': [1, 2, 3]}, dtype='int64')
>>> df
   a  b
0  1  1
1  2  2
2  3  3

Convert to float type:

>>> df.astype('float')
     a    b
0  1.0  1.0
1  2.0  2.0
2  3.0  3.0

Convert to int64 type back:

>>> df.astype('int64')
   a  b
0  1  1
1  2  2
2  3  3

Convert column a to float type:

>>> df.astype({'a': float})
     a  b
0  1.0  1
1  2.0  2
2  3.0  3
def astype(self, dtype: Union[(str, Dtype, Dict[(Name, Union[(str, Dtype)])])]) -> 'DataFrame':
    "\n        Cast a pandas-on-Spark object to a specified dtype ``dtype``.\n\n        Parameters\n        ----------\n        dtype : data type, or dict of column name -> data type\n            Use a numpy.dtype or Python type to cast entire pandas-on-Spark object to\n            the same type. Alternatively, use {col: dtype, ...}, where col is a\n            column label and dtype is a numpy.dtype or Python type to cast one\n            or more of the DataFrame's columns to column-specific types.\n\n        Returns\n        -------\n        casted : same type as caller\n\n        See Also\n        --------\n        to_datetime : Convert argument to datetime.\n\n        Examples\n        --------\n        >>> df = ps.DataFrame({'a': [1, 2, 3], 'b': [1, 2, 3]}, dtype='int64')\n        >>> df\n           a  b\n        0  1  1\n        1  2  2\n        2  3  3\n\n        Convert to float type:\n\n        >>> df.astype('float')\n             a    b\n        0  1.0  1.0\n        1  2.0  2.0\n        2  3.0  3.0\n\n        Convert to int64 type back:\n\n        >>> df.astype('int64')\n           a  b\n        0  1  1\n        1  2  2\n        2  3  3\n\n        Convert column a to float type:\n\n        >>> df.astype({'a': float})\n             a  b\n        0  1.0  1\n        1  2.0  2\n        2  3.0  3\n\n        "
    applied = []
    if is_dict_like(dtype):
        dtype_dict = cast(Dict[(Name, Union[(str, Dtype)])], dtype)
        for col_name in dtype_dict.keys():
            if (col_name not in self.columns):
                raise KeyError('Only a column name can be used for the key in a dtype mappings argument.')
        for (col_name, col) in self.items():
            if (col_name in dtype_dict):
                applied.append(col.astype(dtype=dtype_dict[col_name]))
            else:
                applied.append(col)
    else:
        for (col_name, col) in self.items():
            applied.append(col.astype(dtype=cast(Union[(str, Dtype)], dtype)))
    return DataFrame(self._internal.with_new_columns(applied))