Arize AI
Search…
Mixed Types
Avoid mixed type columns in Pandas DataFrame

Convert mixed type columns to Float

Data ingestion rejects datasets with mixed type columns. These columns should be converted to Float before sending. Below is an example of a mixed type column in Pandas an how to convert it.
1
import pandas as pd
2
3
# Example Series with mixed types
4
mixed = pd.Series([1, "", 2]) # it has numbers and strings
5
mixed.dtype # dtype('O')
6
7
# It should be converted to float
8
# Replace "" with NaN
9
mixed = mixed.replace("", float("NaN"))
10
mixed.dtype # dtype('float64')
Copied!
Questions? Email us at [email protected] or Slack us in the #arize-support channel
Copy link