I am trying to take receive data, bin the data, and then output the data. I am doing so using pandas.cut. I am looking to alter my code so the bounds produced by pandas.cut are whole numbers. Below is my current code:
for (ColumnName, columnData) in df.iteritems():
df[ColumnName+'_binned']=pd.cut(df[ColumnName],number_of_bins))
#cutting each row into bins
I would like the bins to only have whole numbers instead of decimals. For example: the current output is 1.75-5.33. I would like this result to be rounded to 2 - 6. What is the best way to alter my current code? Is this possible? Thank you in advance.