I'm implementing machine learning model and using training dataset from MySQL table and all this is built upon Django. So basically all the calculations are done by converting entire data from MySQL table to dataframe.
df = pd.read_sql("select * from naivebayes_player",connection)
However, I'm facing problem in comparing dataframe column value with a string.
So I have a column named classification in MySQL table which has 2 fixed values 'RS' or 'NRS' stored in varchar(10) format. Since I've converted an entire table into dataframe whenever I calculate the count of 'RS' values in classification column in dataframe it always returns 0. But actually, there are 63 entries of 'RS'.
total_RS = df['classification'][df['classification']=='RS'].count()
In above line of code I'm trying to find out all records where classification is 'RS' which should be 63 but I'm getting 0. What am I doing wrong?
I have tried above code when reading data from CSV instead of MySQL table and everything worked fine.