2021年1月28日星期四

converting strings into integers for a seaborn scatterplot

I'm trying to depict change in vision over time using Python's seaborn scatterplot. My problem is two-fold.

Firstly, the data representing a person's vision at a given point in time is not in the form of an integer, as seen below in the dataset. It is in the form of a fraction, with the distance at which the letter is read as the numerator and the distance at which it ought to be read as the denominator (for example 20/20 being good and 20/100 worse). In cases where the vision is so low that no letters can be made out, HM is used for the ability to see Hand Movement and CF for Counting Fingers. It looks like I'll have to set the string HM as the worst value and the string CF as the second worst and then transition to fractions.

Second, the way that time is represented in the columns is VA before K pro (visual acuity before surgery), VA 0-30d (visual acuity 0 - 30 days) etc.

How do I turn these values into integers so I can depict the change in vision over time with a seaborn scatterplot? I would like the VA data on the y axis and the Time on the x axis.

The problem and material may seem semi-advanced, but I am a beginner/novice in Python, so bear that in mind with the answer.

Thanks, Nate

dataset of vision changes over time

https://stackoverflow.com/questions/65943238/converting-strings-into-integers-for-a-seaborn-scatterplot January 29, 2021 at 02:36AM

没有评论:

发表评论