I have a dataframe, for example:
1
1.3
2,5
4
5
With the following code, I am trying to know what are the types of the different cells of my pandas dataframe:
for i in range(len(data.columns)):
    print(" lenth of  columns : " + str(len(data.columns)))
    for j in range(len(data[i])):
        data[i][j] = re.sub(r'(\d*)\.(\d*)', r'\1,\2', str(data[i][j]))
        print(data[i][j])
        print(" est de type : "type(data[i][j]))
        if str(data[i][j]).isdigit():
            print(str(data[i][j]) + " contain a number  ")
The problem is when a cell of the dataframe contain a dot, pandas thinks it is a string. So I used regex, in order to change the dot into a comma.
But after that, the types of all my dataframe cells changed to string. My question is: How can I know if a cell of the dataframe is an int or a float? I already tried isinstance(x, int)
edit: How can I count the number of int and float, with the output of the df.apply(type)  for example, I want to know how many cells of my column are int or float
My second question is, why when I have 2.5, the dataframe give him the str type?
0       <class 'int'>
1       <class 'str'>
2     <class 'float'>
3     <class 'float'>
4       <class 'int'>
5       <class 'str'>
6       <class 'str'>
 
     
     
    