I'm trying to use value_counts() function from Python's pandas package to find the frequency of items in a column. This works and outputs the following:
57 1811
62 630
71 613
53 217
59 185
68 88
52 70
Name: hospitalized, dtype: int64
In which the first column is the item and the right column is its frequency in the column.
From there, I wanted to access the first column of items and iterate through that in a for loop. I want to be able to access the item of each row and check if it is equal to another value. If this is true, I want to be able to access the second column and divide it by another number.
My big issue is accessing the first column from the .value_counts() output. Is it possible to access this column and if so, how? The columns aren't named anything specific (since it's just the value_counts() output) so I'm unsure how to access them.