I have a pyspark dataframe with following schema:
root
|-- src_ip: integer (nullable = true)
|-- dst_ip: integer (nullable = true)
When converting this dataframe to pandas via toPandas(), the column type changes from integer in spark to float in pandas:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 9847 entries, 0 to 9846
Data columns (total 2 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 src_ip 9607 non-null float64
1 dst_ip 9789 non-null float64
dtypes: float64(2)
memory usage: 154.0 KB
Is there any way to keep integer value with toPandas() or I can only cast column type in resulting pandas dataframe?