Examples
Create a DataFrame:

In [1]:
import numpy as np
import pandas as pd
In [2]:
d = {'c1': [2, 3], 'c2': [4, 5]}
df = pd.DataFrame(data=d)
df.dtypes
Out[2]:
c1    int64
c2    int64
dtype: object

Cast all columns to int32:

In [3]:
df.astype('int32').dtypes
Out[3]:
c1    int32
c2    int32
dtype: object

Cast c1 to int32 using a dictionary:

In [4]:
df.astype({'c1': 'int32'}).dtypes
Out[4]:
c1    int32
c2    int64
dtype: object

Create a series:

In [5]:
s = pd.Series([2, 3], dtype='int32')
s
Out[5]:
0    2
1    3
dtype: int32
In [6]:
s.astype('int64')
Out[6]:
0    2
1    3
dtype: int64

Convert to categorical type:

In [7]:
s.astype('category')
Out[7]:
0    2
1    3
dtype: category
Categories (2, int64): [2, 3]

Convert to ordered categorical type with custom ordering:

In [8]:
cat_dtype = pd.api.types.CategoricalDtype(
                    categories=[3, 2], ordered=True)
In [9]:
s.astype(cat_dtype)
Out[9]:
0    2
1    3
dtype: category
Categories (2, int64): [3 < 2]

Using copy=False and changing data on a new pandas object may propagate changes:

In [10]:
s1 = pd.Series([2,3])
s2 = s1.astype('int64', copy=False)
s2[0] = 8
s1  # note that s1[0] has changed too
Out[10]:
0    8
1    3
dtype: int64