KeyTypes
Source¶
Bases: Enum
How close the types of the two columns of each key of a join must be, used by Join.
A DATE key never matches a DATETIME key, and datetimes must have the same time zone on both sides.
Added in version 0.1.0
Examples:
import numdaplot as ndp
accidents = ndp.Table.from_arrays({"id": ndp.Array.from_list([1, 2])})
users = ndp.Table.from_arrays({"id": ndp.Array.from_list([1.0, 2.0]), "age": ndp.Array.from_list([34, 51])})
accidents.join(ndp.Join(other=users, keys=["id"], key_types=ndp.KeyTypes.SAME_FAMILY)).column_types
# {'id': <Type.FLOAT64: 10>, 'age': <Type.INT64: 4>}
Attributes¶
SAME_FAMILY = auto()
Source¶
Both columns hold numbers, texts, booleans, dates, datetimes, durations or times of day. Default value.
Added in version 0.1.0
The key of the result takes the type holding both: INT64 and FLOAT64 give FLOAT64, TEXT and
CATEGORY give TEXT.
Examples:
import numdaplot as ndp
accidents = ndp.Table.from_arrays({"id": ndp.Array.from_list([1, 2])})
users = ndp.Table.from_arrays({"id": ndp.Array.from_list([1.0, 2.0]), "age": ndp.Array.from_list([34, 51])})
accidents.join(ndp.Join(other=users, keys=["id"], key_types=ndp.KeyTypes.SAME_FAMILY)).column_types
# {'id': <Type.FLOAT64: 10>, 'age': <Type.INT64: 4>}
SAME_TYPE = auto()
Source¶
Both columns have the same type: INT64 and FLOAT64 are refused.
Added in version 0.1.0
Examples:
import numdaplot as ndp
accidents = ndp.Table.from_arrays({"id": ndp.Array.from_list([1, 2])})
users = ndp.Table.from_arrays({"id": ndp.Array.from_list([1.0, 2.0])})
try:
accidents.join(ndp.Join(other=users, keys=["id"], key_types=ndp.KeyTypes.SAME_TYPE))
except ndp.IncompatibleTypesError as error:
print(error)
# Cannot apply Join to the INT64 column 'id' and FLOAT64.