SpecialValues#

class gamspy.SpecialValues[source]#

Bases: object

Methods

isEps()

Check if the input records represent a value close to zero with specific considerations for different data types.

isNA()

Check if values in records represent GAMS NA (Not Available) values.

isNegInf()

Check if the input records represent negative infinity.

isPosInf()

Check if the input records represent positive infinity.

isUndef()

Determine if the given input(s) represent GAMS "undef" values.

NA = nan#
EPS = -0.0#
UNDEF = nan#
POSINF = inf#
NEGINF = -inf#
isEps()[source]#

Check if the input records represent a value close to zero with specific considerations for different data types.

Parameters:
records: int | float | str | pd.Series | pd.DataFrame | array-like

The input records to be checked for proximity to zero.

Returns:
bool

True if the input records represent a value close to zero according to the specified conditions, False otherwise.

Raises:
Exception

If the input (string) records cannot be converted to a float.

Exception

If the data structure passed in ‘records’ could not be converted to a numpy array (dtype=float) for testing.

Parameters:

records (int | float | str | Series | DataFrame)

Return type:

bool

isNA()[source]#

Check if values in records represent GAMS NA (Not Available) values.

Parameters:
records: int | float | str | pd.Series | pd.DataFrame | array-like

The input records to be checked for GAMS NA values.

Returns:
bool

True if the values in records represent GAMS NA values; otherwise, False.

Raises:
Exception

If the input (string) records cannot be converted to a float.

Exception

If the data structure passed in ‘records’ could not be converted to a numpy array (dtype=float) for testing.

Parameters:

records (int | float | str | Series | DataFrame)

Return type:

bool

isUndef()[source]#

Determine if the given input(s) represent GAMS “undef” values.

Parameters:
records: int | float | str | pd.Series | pd.DataFrame | array-like

The input records to be checked for GAMS “undef” values.

Returns:
bool

True if the values in records represent GAMS “undef” values; otherwise, False.

Raises:
Exception

If the input (string) records cannot be converted to a float.

Exception

If the data structure passed in ‘records’ could not be converted to a numpy array (dtype=float) for testing.

Parameters:

records (int | float | str | Series | DataFrame)

Return type:

bool

isPosInf()[source]#

Check if the input records represent positive infinity.

Parameters:
records: int | float | str | pd.Series | pd.DataFrame | array-like

The input records to be checked for positive infinity values.

Returns:
bool

True if the values in records represent positive infinity values; otherwise, False.

Raises:
Exception

If the input (string) records cannot be converted to a float.

Exception

If the data structure passed in ‘records’ could not be converted to a numpy array (dtype=float) for testing.

Parameters:

records (int | float | str | Series | DataFrame)

Return type:

bool

isNegInf()[source]#

Check if the input records represent negative infinity.

Parameters:
records: int | float | str | pd.Series | pd.DataFrame | array-like

The input records to be checked for negative infinity values.

Returns:
bool

True if the values in records represent negative infinity values; otherwise, False.

Raises:
Exception

If the input (string) records cannot be converted to a float.

Exception

If the data structure passed in ‘records’ could not be converted to a numpy array (dtype=float) for testing.

Parameters:

records (int | float | str | Series | DataFrame)

Return type:

bool