Tsallaka zuwa abun ciki
Justice Tech School

Data Types

Every Series has one dtype such as int64, float64, bool or str. pandas picks a dtype that fits all values, so one float turns integers into floats.

Example
import pandas as pd
import numpy as np
print(pd.Series([1, 2, 3]).dtype)
print(pd.Series([1, 2.5]).dtype)
print(pd.Series([True, False]).dtype)
print(pd.Series([1, 2, 3]).astype('float64').tolist())

Result

int64
float64
bool
[1.0, 2.0, 3.0]

Exercise

See the type.

s.

Quiz Test

Why is [1, 2.5] a float Series?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.