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

Popular posts from this blog

2. FreeCodeCamp - Dynamic Programming - Learn to Solve Algorithmic Problems & Coding Challenges

20. Data Analytics - Analyze Data to Answer Questions - Week 1

3. Algorithms - Selection Sort