Weight¶
- rupantaran.weight.weight.from_chatak(value: float, to_unit: str, precision: int = 4) float[source]¶
Converts a value from chatak to other weight units.
- Parameters:
value (float) – The numeric amount to convert (must be non-negative).
to_unit (str) – The target weight unit (e.g., ‘lal’, ‘tola’, ‘pau’, ‘dharni’, ‘sher’, ‘kg’, ‘g’, ‘lb’, ‘oz’).
precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.
- Returns:
Equivalent weight in the target unit, rounded to the specified precision.
- Return type:
float
- Raises:
ValueError –
If value is negative or not a number.
If precision is negative.
If to_unit is not a recognized weight unit.
Example¶
- rupantaran.weight.weight.from_dharni(value: float, to_unit: str, precision: int = 4) float[source]¶
Converts a value from dharni to other weight units.
- Parameters:
value (float) – The numeric amount to convert (must be non-negative).
to_unit (str) – The target weight unit (e.g., ‘lal’, ‘chatak’,’tola’, ‘pau’, ‘sher’, ‘kg’, ‘g’, ‘lb’, ‘oz’).
precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.
- Returns:
Equivalent weight in the target unit, rounded to the specified precision.
- Return type:
float
- Raises:
ValueError –
If value is negative or not a number.
If precision is negative.
If to_unit is not a recognized weight unit.
Example¶
- rupantaran.weight.weight.from_g(value: float, to_unit: str, precision: int = 4) float[source]¶
Converts a value from grams to other weight units.
- Parameters:
value (float) – The numeric amount to convert (must be non-negative).
to_unit (str) – The target weight unit (e.g., ‘lal’, ‘tola’, ‘chatak’, ‘pau’, ‘dharni’, ‘sher’, ‘kg’, ‘lb’, ‘oz’).
precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.
- Returns:
Equivalent weight in the target unit, rounded to the specified precision.
- Return type:
float
- Raises:
ValueError –
If value is negative or not a number.
If precision is negative.
If to_unit is not a recognized weight unit.
Example¶
- rupantaran.weight.weight.from_kg(value: float, to_unit: str, precision: int = 4) float[source]¶
Converts a value from kilograms to other weight units.
- Parameters:
value (float) – The numeric amount to convert (must be non-negative).
to_unit (str) – The target weight unit (e.g., ‘lal’, ‘tola’, ‘chatak’, ‘pau’, ‘dharni’, ‘sher’, ‘g’, ‘lb’, ‘oz’).
precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.
- Returns:
Equivalent weight in the target unit, rounded to the specified precision.
- Return type:
float
- Raises:
ValueError –
If value is negative or not a number.
If precision is negative.
If to_unit is not a recognized weight unit.
Example¶
- rupantaran.weight.weight.from_lal(value: float, to_unit: str, precision: int = 4) float[source]¶
Converts a value from lal to other weight units.
- Parameters:
value (float) – The numeric amount to convert (must be non-negative).
to_unit (str) – The target weight unit (e.g., ‘tola’, ‘chatak’, ‘pau’, ‘dharni’, ‘sher’, ‘kg’, ‘g’, ‘lb’, ‘oz’).
precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.
- Returns:
Equivalent weight in the target unit, rounded to the specified precision.
- Return type:
float
- Raises:
ValueError –
If value is negative or not a number.
If precision is negative.
If to_unit is not a recognized weight unit.
Example¶
- rupantaran.weight.weight.from_lb(value: float, to_unit: str, precision: int = 4) float[source]¶
Converts a value from pounds to other weight units.
- Parameters:
value (float) – The numeric amount to convert (must be non-negative).
to_unit (str) – The target weight unit (e.g., ‘lal’, ‘tola’, ‘chatak’, ‘pau’, ‘dharni’, ‘sher’, ‘g’, ‘kg’, ‘oz’).
precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.
- Returns:
Equivalent weight in the target unit, rounded to the specified precision.
- Return type:
float
- Raises:
ValueError –
If value is negative or not a number.
If precision is negative.
If to_unit is not a recognized weight unit.
Example¶
- rupantaran.weight.weight.from_oz(value: float, to_unit: str, precision: int = 4) float[source]¶
Converts a value from ounces to other weight units.
- Parameters:
value (float) – The numeric amount to convert (must be non-negative).
to_unit (str) – The target weight unit (e.g., ‘lal’, ‘tola’, ‘chatak’, ‘pau’, ‘dharni’, ‘sher’, ‘g’, ‘lb’, ‘kg’).
precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.
- Returns:
Equivalent weight in the target unit, rounded to the specified precision.
- Return type:
float
- Raises:
ValueError –
If value is negative or not a number.
If precision is negative.
If to_unit is not a recognized weight unit.
Example¶
- rupantaran.weight.weight.from_pau(value: float, to_unit: str, precision: int = 4) float[source]¶
Converts a value from pau to other weight units.
- Parameters:
value (float) – The numeric amount to convert (must be non-negative).
to_unit (str) – The target weight unit (e.g., ‘lal’, ‘chatak’, ‘tola’, ‘dharni’, ‘sher’, ‘kg’, ‘g’, ‘lb’, ‘oz’).
precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.
- Returns:
Equivalent weight in the target unit, rounded to the specified precision.
- Return type:
float
- Raises:
ValueError –
If value is negative or not a number.
If precision is negative.
If to_unit is not a recognized weight unit.
Example¶
- rupantaran.weight.weight.from_sher(value: float, to_unit: str, precision: int = 4) float[source]¶
Converts a value from sher to other weight units.
- Parameters:
value (float) – The numeric amount to convert (must be non-negative).
to_unit (str) – The target weight unit (e.g., ‘lal’, ‘chatak’,’tola’, ‘pau’, ‘dharni’, ‘kg’, ‘g’, ‘lb’, ‘oz’).
precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.
- Returns:
Equivalent weight in the target unit, rounded to the specified precision.
- Return type:
float
- Raises:
ValueError –
If value is negative or not a number.
If precision is negative.
If to_unit is not a recognized weight unit.
Example¶
- rupantaran.weight.weight.from_tola(value: float, to_unit: str, precision: int = 4) float[source]¶
Converts a value from tola to other weight units.
- Parameters:
value (float) – The numeric amount to convert (must be non-negative).
to_unit (str) – The target weight unit (e.g., ‘lal’, ‘chatak’, ‘pau’, ‘dharni’, ‘sher’, ‘kg’, ‘g’, ‘lb’, ‘oz’).
precision (int, optional) – Number of decimal places to round to (must be non-negative). Default is 4.
- Returns:
Equivalent weight in the target unit, rounded to the specified precision.
- Return type:
float
- Raises:
ValueError –
If value is negative or not a number.
If precision is negative.
If to_unit is not a recognized weight unit.
Example¶