Skip to content
Advertisement

Including specific strings in missing values count

I need to determine the percentage of missing and not available values.

I have approx. 30 columns and data for missing are NA, ‘Information not found’ (string), and ‘Data not available’ (string). For determining the pct of missing (NA) values, I am using the following:

JavaScript

How can I include also the other two cases (‘Information not found’ and ‘Data not available’)?

For example:

JavaScript

ex1 and ex2 are just dummies.

Expected output:

JavaScript

for each column:

JavaScript

Advertisement

Answer

You can use value_counts:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement