Q: data type conversion in dataFrame I have a csv file which has a column named population. In this CSV file the values of this column are shown as decimal (float) i.e. for e.g. 12345.00. I have converted whole of this file to ttl RDF format, and the population literal is shown as the same i.e. 12345.0 in the ttl file. I want it to show as integer (whole number) i.e. 12345 - Do I need to convert the data type of this column or what to do? Also, I would ask how can I check the data type of a column of a dataFrame in python?
(A beginner in python)- Thanks

A: You can try change the column data type first.
For example
df = pd.DataFrame([1.0,2.0,3.0,4.0], columns=['A'])

    A
0  1.0
1  2.0
2  3.0
3  4.0
Name: A, dtype: float64

now
df['A'] = df['A'].astype(int)

    A
0  1.0
1  2.0
2  3.0
3  4.0
Name: A, dtype: int32

If you have some np.NaN in the column you can try
df = df.astype('Int64')

This will get you
     A
 0  1.0
 1  2.0
 2  3.0
 3  4.0
 4  <NA>

Where < NA> is the Int64 equilavent to np.NaN. Is important to know that np:NaN is a float and < NA> is not widely used yet and is not memory and performance optimized, you can read more about here
https://pandas.pydata.org/docs/user_guide/missing_data.html#integer-dtypes-and-missing-data

A: csv_data['theColName'] = csv_data['theColName'].fillna(0)
csv_data['theColName'] = csv_data['theColName'].astype('int64') worked and the column is successfully converted to int64. Thanks everybody
