pystreamapi
GitHub
  • Welcome to PyStreamAPI!
  • Quick Start
  • Reference
    • API Reference
      • Intermediate Operations
      • Terminal Operations
      • Numeric Stream
      • Error handling
    • Conditions
      • Type Conditions
      • Numeric Conditions
      • String Conditions
      • Date conditions
    • Data Loaders
  • Examples
  • Performance
  • Contribute
Powered by GitBook
On this page
  • interquartile_range(): Calculate the interquartile range
  • first_quartile(): Calculate the first quartile
  • mean(): Calculate the mean
  • median(): Calculate the median
  • mode(): Calculate the mode
  • range(): Calculate the range
  • third_quartile(): Calculate the range
  • sum(): Calculate the sum

Was this helpful?

Edit on GitHub
  1. Reference
  2. API Reference

Numeric Stream

PreviousTerminal OperationsNextError handling

Last updated 16 days ago

Was this helpful?

For information on how to create a NumericStream please visit the Quick Start docs:

interquartile_range(): Calculate the interquartile range

Calculates the interquartile range of a numerical Stream. Returns either int or float.

Stream.of([1, 2, 3, 4, 5, 7, 7, 8, 9, 9]) \
    .interquartile_range() # Returns 5

first_quartile(): Calculate the first quartile

Calculates the first quartile of a numerical Stream. Returns either int or float.

Stream.of([1, 2, 3, 4, 5, 7, 7, 8, 9, 9]) \
    .first_quartile() # Returns 3

mean(): Calculate the mean

Calculates the mean of a numerical Stream. Returns either int or float.

Stream.of([1, 2, 3, 4, 5, 7, 7, 8, 9, 9]) \
    .mean() # Returns 5.5

median(): Calculate the median

Calculates the median of a numerical Stream. Returns either int or float.

Stream.of([1, 2, 3, 4, 5, 7, 7, 8, 9, 9]) \
    .median() # Returns 6.0

mode(): Calculate the mode

Calculates the mode(s) (most frequently occurring element/elements) of a numerical Stream. Returns a list of either int, floator None.

Stream.of([1, 2, 3, 4, 5, 7, 7, 8, 9, 9]) \
    .mode() # Returns [7, 9]

range(): Calculate the range

Calculates the range of a numerical Stream. Returns either int or float.

Stream.of([1, 2, 3, 4, 5, 7, 7, 8, 9, 9]) \
    .range() # Returns 8

third_quartile(): Calculate the range

Calculates the third quartile of a numerical Stream. Returns either int or float.

Stream.of([1, 2, 3, 4, 5, 7, 7, 8, 9, 9]) \
    .third_quartile() # Returns 8

sum(): Calculate the sum

Calculates the sum of all elements of a numerical Stream. Returns either int or float.

Stream.of([1, 2, 3]) \
    .sum() # Returns 6
Stream.of()