I have a data frame that was taken from a survey. I have two columns: the number ID of the respondent and the database they worked with.
Respondent DatabaseWorkedWith
0 4 MySQL
1 4 SQLite
2 9 DynamoDB
3 9 PostgreSQL
4 9 SQLite
... ... ...
31370 25137 MySQL
31371 25138 PostgreSQL
31372 25141 Microsoft SQL Server
31373 25141 Redis
31374 25142 PostgreSQL
31375 rows × 2 columns
The question is on the title. I would like to count the number of respondents that only have MySQL on the second column. I’m not sure if I should use unique, groupby or another method.
Thanks!
2
Answers
I came up with a solution that may not be the most practical one, but it worked.
First, I created a data frame summing the column 'DatabaseWorkedWith':
Using the new data frame, I counted by the column 'DatabaseWorkedWith' where the value was 'MySQL.'
If you guys could present a more elegant solution, I would appreciate it! Thanks!
I have a solution which can do the work.
You can drop all the rows with duplicated values in Column ‘Respondent’, then filter the DatabaseWorkedWith with MySQL.
Here is the code