Arize AI
Search…
⌃K

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.
import pandas as pd
# Example Series with mixed types
mixed = pd.Series([1, "", 2]) # it has numbers and strings
mixed.dtype # dtype('O')
# It should be converted to float
# Replace "" with NaN
mixed = mixed.replace("", float("NaN"))
mixed.dtype # dtype('float64')
Questions? Email us at [email protected] or Slack us in the #arize-support channel