9951 explained code solutions for 126 technologies

python-pandasHow to floor values in dataframe

import pandas as pd
import numpy as np

df = pd.DataFrame({
  'phone': ['ip5', 'ip6', 'ip8', 'sms', 'xi'],
  'price': [204.10, 304.99, 404.5, 405.5, 305.90]

df['price'] = df['price'].apply(np.floor)ctrl + c
import pandas as pd

load Pandas module


creates Pandas DataFrame object


applies given callback to all values of given column (or multiple columns)


Numpy module floor function