Created
September 3, 2019 02:16
-
-
Save marty1885/5704dfda4fd6557723b4ee4ec0024880 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void count_zeros() | |
{ | |
// Now we can use the new and improved RDataFrame interface | |
auto rdf = ROOT::RDataFrame("library_raw", "library.root"); | |
auto columns = rdf.GetColumnNames(); | |
auto empty_lst = std::map<std::string, size_t>(); | |
ProgressDisplay disp(*rdf.Count()*columns.size()); | |
size_t finished = 0; | |
for(auto column : columns) { | |
size_t empty_count = 0; | |
rdf.Foreach([&](std::string s) { | |
empty_count += (s == ""); | |
finished += 1; | |
if(finished%100000 == 0) | |
disp.update(finished); | |
}, {column}); | |
empty_lst[column] = empty_count; | |
} | |
std::cout << "\n"; | |
for(auto [column, count] : empty_lst) | |
std::cout << "Column " << column << ", have " << count << " empty entries" << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment