Skip to content

Commit

Permalink
Adds Percentage to transformations
Browse files Browse the repository at this point in the history
  • Loading branch information
pipliggins committed Sep 26, 2023
1 parent 610e8d6 commit 6d46594
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions adtl/transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,19 @@ def getFloat(
return value


def Percentage(value: float):
"transform a decimal into a percentage"
try:
value = float(value)
except ValueError:
return value

if value > 1 or value is None:
return value

return value * 100


def yearsElapsed(
birthdate: str,
currentdate: str,
Expand Down

0 comments on commit 6d46594

Please sign in to comment.