I tried to convert a column from data type float64 to int64 using:
df[\'column name\'].astype(int64)
but got an e
You can need to pass in the string 'int64':
>>> import pandas as pd
>>> df = pd.DataFrame({'a': [1.0, 2.0]}) # some test dataframe
>>> df['a'].astype('int64')
0 1
1 2
Name: a, dtype: int64
There are some alternative ways to specify 64-bit integers:
>>> df['a'].astype('i8') # integer with 8 bytes (64 bit)
0 1
1 2
Name: a, dtype: int64
>>> import numpy as np
>>> df['a'].astype(np.int64) # native numpy 64 bit integer
0 1
1 2
Name: a, dtype: int64
Or use np.int64 directly on your column (but it returns a numpy.array):
>>> np.int64(df['a'])
array([1, 2], dtype=int64)