I have Pandas dataframe, that has the length of "state" column. I am 100% sure, the length of all the values in the column is 2. When I try to write an assert statement, I am getting an assertion error. I am not sure if I am using the assert statement correctly. Please help.
assert df['state'].str.len().all() == 2
My understanding: assert that all the values in the state column have a length that is equal to 2. Please let me know if this is correct. Thank You.