52 template<
typename dtype>
61 std::vector<dtype> values;
62 for (
auto value : inArray)
64 if (!std::isnan(value))
66 values.push_back(value);
70 const uint32 middle =
static_cast<uint32>(values.size()) / 2;
80 for (
uint32 row = 0; row < inShape.
rows; ++row)
82 std::vector<dtype> values;
83 for (
uint32 col = 0; col < inShape.
cols; ++col)
85 if (!std::isnan(inArray(row, col)))
87 values.push_back(inArray(row, col));
91 const uint32 middle =
static_cast<uint32>(values.size()) / 2;
93 returnArray(0, row) = values[middle];
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
#define STATIC_ASSERT_FLOAT(dtype)
Definition StaticAsserts.hpp:50
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:135
self_type transpose() const
Definition NdArrayCore.hpp:4959
const Shape & shape() const noexcept
Definition NdArrayCore.hpp:4587
A Shape Class for NdArrays.
Definition Core/shape.hpp:41
uint32 rows
Definition Core/shape.hpp:44
uint32 cols
Definition Core/shape.hpp:45
void nth_element(RandomIt first, RandomIt nth, RandomIt last) noexcept
Definition StlAlgorithms.hpp:426
Definition Cartesian.hpp:39
Axis
Enum To describe an axis.
Definition Enums.hpp:36
@ ROW
Definition Enums.hpp:38
@ COL
Definition Enums.hpp:39
@ NONE
Definition Enums.hpp:37
std::uint32_t uint32
Definition Types.hpp:40
NdArray< dtype > nanmedian(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition nanmedian.hpp:53