File: floatcolumn.py

package info (click to toggle)
python-clickhouse-driver 0.2.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,516 kB
  • sloc: python: 10,950; pascal: 42; makefile: 31; sh: 3
file content (24 lines) | stat: -rw-r--r-- 599 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import numpy as np

from .base import NumpyColumn

# normalize_null_value = False due to float('nan')
# With normalization pandas.isnull will threat float('nan') as NULL value.


class NumpyFloat32Column(NumpyColumn):
    dtype = np.dtype(np.float32)
    ch_type = 'Float32'
    normalize_null_value = False

    def _get_nulls_map(self, items):
        return [x is None for x in items]


class NumpyFloat64Column(NumpyColumn):
    dtype = np.dtype(np.float64)
    ch_type = 'Float64'
    normalize_null_value = False

    def _get_nulls_map(self, items):
        return [x is None for x in items]