Example #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
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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)
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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