Exemplo n.º 1
0
 def __init__(self, dtype, missing_value, name, doc, metadata,
              currency_aware):
     # Validating and calculating default missing values here guarantees
     # that we fail quickly if the user passes an unsupporte dtype or fails
     # to provide a missing value for a dtype that requires one
     # (e.g. int64), but still enables us to provide an error message that
     # points to the name of the failing column.
     try:
         self.dtype, self.missing_value = validate_dtype(
             termname="Column(name={name!r})".format(name=name),
             dtype=dtype,
             missing_value=missing_value,
         )
     except NoDefaultMissingValue:
         # Re-raise with a more specific message.
         raise NoDefaultMissingValue(
             "Failed to create Column with name {name!r} and"
             " dtype {dtype} because no missing_value was provided\n\n"
             "Columns with dtype {dtype} require a missing_value.\n"
             "Please pass missing_value to Column() or use a different"
             " dtype.".format(dtype=dtype, name=name))
     self.name = name
     self.doc = doc
     self.metadata = metadata
     self.currency_aware = currency_aware
Exemplo n.º 2
0
 def __init__(self, dtype, missing_value, name):
     # Validating and calculating default missing values here guarantees
     # that we fail quickly if the user passes an unsupporte dtype or fails
     # to provide a missing value for a dtype that requires one
     # (e.g. int64), but still enables us to provide an error message that
     # points to the name of the failing column.
     try:
         self.dtype, self.missing_value = validate_dtype(
             termname="Column(name={name!r})".format(name=name),
             dtype=dtype,
             missing_value=missing_value,
         )
     except NoDefaultMissingValue:
         # Re-raise with a more specific message.
         raise NoDefaultMissingValue(
             "Failed to create Column with name {name!r} and"
             " dtype {dtype} because no missing_value was provided\n\n"
             "Columns with dtype {dtype} require a missing_value.\n"
             "Please pass missing_value to Column() or use a different"
             " dtype.".format(dtype=dtype, name=name)
         )
     self.name = name