degrees()#

relationalai.std.math
#degrees(radians: Number | Producer) -> Expression

Converts radians to degrees. Must be called in a rule or query context.

Parameters#

NameTypeDescription
radiansNumber or ProducerThe number of radians to convert to degrees.

Returns#

An Expression object that produces float values.

Example#

degrees() works with both numeric producers and Python number objects:

#import relationalai as rai
from relationalai.std import alias
from relationalai.std.math import degrees

# Create a model named "people" with a Person type.
model = rai.Model("people")
Person = model.Type("Person")

# Add a person to the model.
with model.rule():
    Person.add(name="Alice", age=30)

# degrees() works with numeric producers, such as a person's age property.
with model.query() as select:
    person = Person()
    response = select(person.name, alias(degrees(person.age), "degrees_age"))

print(response.results)
# Output:
#     name  degrees_age
# 0  Alice  1718.873385

# degrees() also works with Python number objects.
with model.query() as select:
    response = select(degrees(3.141593))

print(response.results)
# Output:
#            v
# 0  180.00002

See Also#