SciPy Constants

SciPy Constants

Constants in SciPy

As SciPy is more focused on scientific implementations, it provides many built-in scientific constants.

These constants can be helpful when you are working with Data Science.

PI is an example of a scientific constant.

Example

Print the constant value of PI:

Try it Yourself »


Constant Units

A list of all units under the constants module can be seen using the dir() function.

Example

List all constants:

Try it Yourself »


Unit Categories

The units are placed under these categories:

  • Metric
  • Binary
  • Mass
  • Angle
  • Time
  • Length
  • Pressure
  • Volume
  • Speed
  • Temperature
  • Energy
  • Power
  • Force

Metric (SI) Prefixes:

Return the specified unit in meter (e.g. centi returns 0.01)

Example

Try it Yourself »

Binary Prefixes:

Return the specified unit in bytes (e.g. kibi returns 1024)

Example

Try it Yourself »

Mass:

Return the specified unit in kg (e.g. gram returns 0.001)

Example

Try it Yourself »

Angle:

Return the specified unit in radians (e.g. degree returns 0.017453292519943295)

Example

Try it Yourself »

Time:

Return the specified unit in seconds (e.g. hour returns 3600.0)

Example

Try it Yourself »

Length:

Return the specified unit in meters (e.g. nautical_mile returns 1852.0)

Example

Try it Yourself »

Pressure:

Return the specified unit in pascals (e.g. psi returns 6894.757293168361)

Example

Try it Yourself »

Area:

Return the specified unit in square meters(e.g. hectare returns 10000.0)

Example

Try it Yourself »

Volume:

Return the specified unit in cubic meters (e.g. liter returns 0.001)

Example

Try it Yourself »

Speed:

Return the specified unit in meters per second (e.g. speed_of_sound returns 340.5)

Example

Try it Yourself »

Temperature:

Return the specified unit in Kelvin (e.g. zero_Celsius returns 273.15)

Example

Try it Yourself »

Energy:

Return the specified unit in joules (e.g. calorie returns 4.184)

Example

Try it Yourself »

Power:

Return the specified unit in watts (e.g. horsepower returns 745.6998715822701)

Example

Try it Yourself »

Force:

Return the specified unit in newton (e.g. kilogram_force returns 9.80665)

Example

Try it Yourself »


Test Yourself With Exercises

Exercise:

Insert the correct syntax for printing the kilometer unit (in meters):

Start the Exercise

ArmenianEnglish