Ticket #1149 (closed wish: fixed)

Opened 3 years ago

Last modified 3 years ago

to_numpy should return empty array instead of None if requested data does not exist

Reported by: anze Owned by: janez
Milestone: Next 2.x Component: library
Severity: minor Keywords:
Cc: Blocking:
Blocked By:


When calling to_numpy("c") on a classless domain, it returns (None,). It would be nice, if it returned an empty numpy array of size (no_of_examples, 0).

Instance method get_classes already behaves this way (it returns [] if no class variables exist and not None).

Change History

comment:1 Changed 3 years ago by anze

Same should work for to_numpy("m").

comment:2 Changed 3 years ago by janez

Done. Since we don't have unit tests for this (right?) but you have some fresh code that uses to_numpy, please check that I haven't broken anything. Please close the ticket if it's OK.

I haven't checked with "m", but it should work the same (the code is not specific to the type of the data).

comment:3 Changed 3 years ago by anze

  • Status changed from new to closed
  • Resolution set to fixed

Works as suggested.

Implemented in 4e2c1f5ede07.

Note: See TracTickets for help on using tickets.