BUG/ENH: fix and improve constant detection

see #1794 and #1792

constant detection has now several layers of checks

- (1) hasconst
- (2) find column with ptp=0
       - find column with mean = 1
       - find column with mean !=0
- (3) find implicit constant

a column of zeros does not count as constant anymore, const in (2) needs ptp==0 and mean !=0

still open:
- `hasconst` assumes implicit constant or no constant, cannot be used to specify `const_idx`
- column of zeros prevents implicit constant check

- make it into standalone function and return (k_constant, const_idx) instead of attaching it directly.