Round, Ceiling & Floor of a Column In a DataFrame

Python
Data Preprocessing

 1|  import numpy as np
 2|  
 3|  # round
 4|  df['round'] = df['Age'].round(decimals=0)
 5|  
 6|  #ceiling
 7|  df['ceiling'] = df['Age'].apply(np.ceil)
 8|  
 9|  # floor
10|  df['floor'] = df['Age'].apply(np.floor)
1 Upvote
Tags: Floor | Round | Ceiling
Did you find this snippet useful?

Sign up to bookmark this in your snippet library

Normalize Windowed Time Series
Python
Data Preprocessing

Scaler | Normalize | Scale | Min-max

4
Pivoting Pandas Dataframes
Python
Data Preprocessing

Pandas

3