Closed YoungjaeDev closed 1 year ago
#include "NumCpp.hpp"
#include <iostream>
int main()
{
nc::random::seed(666);
auto a = nc::random::randFloat<double>({ 4, 6 }, 1);
a(0, 0) = nc::constants::nan;
a(-1, -1) = nc::constants::nan;
std::cout << "a:\n" << a << '\n';
auto [_, rowNonNanIndices] = (!nc::isnan(a).any(nc::Axis::COL)).nonzero();
auto noNanRows = a(rowNonNanIndices, a.cSlice());
std::cout << "noNanRows:\n" << noNanRows;
return 0;
}
which outputs:
a:
[[nan, 0.454037, 0.275594, 0.066487, 0.397731, 0.550428, ]
[0.267218, 0.349375, 0.818072, 0.883664, 0.474568, 0.25094, ]
[0.738563, 0.0835627, 0.0451471, 0.803801, 0.510884, 0.651005, ]
[0.668859, 0.493873, 0.534184, 0.867498, 0.984127, nan, ]]
noNanRows:
[[0.267218, 0.349375, 0.818072, 0.883664, 0.474568, 0.25094, ]
[0.738563, 0.0835627, 0.0451471, 0.803801, 0.510884, 0.651005, ]]
I'll close issue after testing. thank you
Closing due to inactivity.
What I want to do is delete the row that contains nan.