Exemplo n.º 1
0
 def test_dtype_datetime64(self):
     df = pd.DataFrame({
         'col': [pd.Timestamp('2010-11-01 00:01:00'),
                 pd.Timestamp('2010-11-01 00:02:00.1000'),
                 pd.Timestamp('2010-11-01 00:03:00.300000')]})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'timestamp')])
     assert inferred == expected
Exemplo n.º 2
0
 def test_dtype_timedelta64(self):
     df = pd.DataFrame({
         'col': [pd.Timedelta('1 days'),
                 pd.Timedelta('-1 days 2 min 3us'),
                 pd.Timedelta('-2 days +23:57:59.999997')]})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'int64')])
     assert inferred == expected
Exemplo n.º 3
0
 def test_dtype_timedelta64(self):
     df = pd.DataFrame({
         'col': [
             pd.Timedelta('1 days'),
             pd.Timedelta('-1 days 2 min 3us'),
             pd.Timedelta('-2 days +23:57:59.999997')
         ]
     })
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'int64')])
     assert inferred == expected
Exemplo n.º 4
0
 def test_dtype_datetime64(self):
     df = pd.DataFrame({
         'col': [
             pd.Timestamp('2010-11-01 00:01:00'),
             pd.Timestamp('2010-11-01 00:02:00.1000'),
             pd.Timestamp('2010-11-01 00:03:00.300000')
         ]
     })
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'timestamp')])
     assert inferred == expected
Exemplo n.º 5
0
 def test_dtype_uint16(self):
     df = pd.DataFrame({'col': np.uint16([5569, 1, 33])})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'int32')])
     assert inferred == expected
Exemplo n.º 6
0
 def test_dtype_float64(self):
     df = pd.DataFrame({'col': np.float64([-3e43, 43., 10000000.])})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'double')])
     assert inferred == expected
Exemplo n.º 7
0
 def test_dtype_float32(self):
     df = pd.DataFrame({'col': np.float32([45e-3, -0.4, 99.])})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'float')])
     assert inferred == expected
Exemplo n.º 8
0
 def test_dtype_int32(self):
     df = pd.DataFrame({'col': np.int32([-12, 3, 25000])})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'int32')])
     assert inferred == expected
Exemplo n.º 9
0
 def test_dtype_bool(self):
     df = pd.DataFrame({'col': [True, False, False]})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'boolean')])
     assert inferred == expected
Exemplo n.º 10
0
 def test_dtype_string(self):
     df = pd.DataFrame({'col': ['foo', 'bar', 'hello']})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'string')])
     assert inferred == expected
Exemplo n.º 11
0
 def test_dtype_string(self):
     df = pd.DataFrame({'col': ['foo', 'bar', 'hello']})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'string')])
     assert inferred == expected
Exemplo n.º 12
0
 def test_dtype_uint64(self):
     df = pd.DataFrame({'col': np.uint64([666, 2, 3])})
     with self.assertRaises(IbisTypeError):
         inferred = pandas_to_ibis_schema(df)  # noqa
Exemplo n.º 13
0
 def test_dtype_uint32(self):
     df = pd.DataFrame({'col': np.uint32([100, 0, 6])})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'int64')])
     assert inferred == expected
Exemplo n.º 14
0
 def test_dtype_uint16(self):
     df = pd.DataFrame({'col': np.uint16([5569, 1, 33])})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'int32')])
     assert inferred == expected
Exemplo n.º 15
0
 def test_dtype_float64(self):
     df = pd.DataFrame({'col': np.float64([-3e43, 43., 10000000.])})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'double')])
     assert inferred == expected
Exemplo n.º 16
0
 def test_dtype_uint32(self):
     df = pd.DataFrame({'col': np.uint32([100, 0, 6])})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'int64')])
     assert inferred == expected
Exemplo n.º 17
0
 def test_dtype_uint64(self):
     df = pd.DataFrame({'col': np.uint64([666, 2, 3])})
     with self.assertRaises(IbisTypeError):
         inferred = pandas_to_ibis_schema(df)
Exemplo n.º 18
0
 def test_dtype_categorical(self):
     df = pd.DataFrame({'col': ['a', 'b', 'c', 'a']}, dtype='category')
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', dt.Category(3))])
     assert inferred == expected
Exemplo n.º 19
0
 def test_dtype_bool(self):
     df = pd.DataFrame({'col': [True, False, False]})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'boolean')])
     assert inferred == expected
Exemplo n.º 20
0
 def test_dtype_int16(self):
     df = pd.DataFrame({'col': np.int16([-5, 0, 12])})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'int16')])
     assert inferred == expected
Exemplo n.º 21
0
 def test_dtype_categorical(self):
     df = pd.DataFrame({'col': ['a', 'b', 'c', 'a']}, dtype='category')
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', dt.Category(3))])
     assert inferred == expected
Exemplo n.º 22
0
 def test_dtype_int32(self):
     df = pd.DataFrame({'col': np.int32([-12, 3, 25000])})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'int32')])
     assert inferred == expected
Exemplo n.º 23
0
 def test_dtype_int16(self):
     df = pd.DataFrame({'col': np.int16([-5, 0, 12])})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'int16')])
     assert inferred == expected
Exemplo n.º 24
0
 def test_dtype_float32(self):
     df = pd.DataFrame({'col': np.float32([45e-3, -0.4, 99.])})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'float')])
     assert inferred == expected
Exemplo n.º 25
0
 def test_dtype_int64(self):
     df = pd.DataFrame({'col': np.int64([102, 67228734, -0])})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'int64')])
     assert inferred == expected
Exemplo n.º 26
0
 def test_dtype_int64(self):
     df = pd.DataFrame({'col': np.int64([102, 67228734, -0])})
     inferred = pandas_to_ibis_schema(df)
     expected = ibis.schema([('col', 'int64')])
     assert inferred == expected