I need to calculate frequency of float elements in list. Convert them to int I can't, because I need to manipulate then float values, not int.
My try in the code below:
values = [21.963, 23.4131, 23.7639, 24.3934, 24.5237, 25.2829, 25.394]
df = pd.Series(values).value_counts().sort_index().reset_index().reset_index(drop=True)
df.columns = ['Element', 'Frequency']
frequency = (df['Frequency'].values).tolist()
hovewer I want to have two separate lists(not dataframe):
- List of float elements
- List of frequencies of float elements given
Expected output:
values = [21.963, 23.4131, 23.7639, 24.3934, 24.5237, 25.2829, 25.394]
frequency = [1, 1, 1, 1, 1, 1, 1]