16. Python - Pandas - Data Types & Missing Values
Data Types:
Common Types: floats, int, object (string or mixed), bool, str
Find Data Type:
data_frame.COLUMNA.dtype
// returns a type
Converting Types:
data_frame.COLUMNA.astype('float64')
// coverts COLUMNA type to float type
data_frame.index.dtype
// return type of the index
Missing Data:
// Filter with:
pd.isnull(data_frame.COLUMN)
pd.notnull(data_frame.COLUMN)
// Filling data: // creates a series with filled data
data_frame.COLUMN.fillna("SOMETHING")
// filles all NaN in COLUMN with "SOMETHING"
Replacing Data:
data_frame.COLUMN.replace("ORIGINAL","REPLACER")
// replaces value
Comments
Post a Comment