utils

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Float64Seq

func Float64Seq(start, end, step float64, max ...int) []float64

Float64Seq will return a sequence of float64 values starting at start.

func Int64Seq

func Int64Seq(start, end, step int64, max ...int) []int64

Int64Seq will return a sequence of int64 values starting at start.

func IntSeq

func IntSeq(start, end, step int, max ...int) []int

IntSeq will return a sequence of int values starting at start.

func Reverse

func Reverse(ctx context.Context, sdf common, opts ...ReverseOptions) error

Reverse will reverse the order of a Dataframe or Series. If a Range is provided, only the rows within the range are reversed. s will be locked for the duration of the operation.

func Search(ctx context.Context, s dataframe.Series, lower, upper interface{}, opts ...SearchOptions) ([]int, error)

Search is used to find particular values in a given Series. It will find all values that are between lower and upper bounds (inclusive). It will return a slice containing the rows which contain values within the bounds. If Search is canceled, an incomplete list of the rows "found so far" is returned. s will be locked for the duration of the operation.

Example:

s1 := dataframe.NewSeriesInt64("", nil, 11, 10, 9, 8, 7, 6, 5, 23, 25, 2, 1, 5, 4)

fmt.Println(utils.Search(ctx, s1, int64(4), int64(6)))
// Output: [5 6 11 12]

func Shuffle

func Shuffle(ctx context.Context, sdf common, opts ...ShuffleOptions) (rErr error)

Shuffle will randomly shuffle the rows in a Dataframe or Series. If a Range is provided, only the rows within the range are shuffled. s will be locked for the duration of the operation.

Types

type ReverseOptions

type ReverseOptions struct {

	// R is used to limit the range of the Series for search purposes.
	R *dataframe.Range

	// DontLock can be set to true if the Series should not be locked.
	DontLock bool
}

ReverseOptions modifies the behavior of Reverse.

type SearchOptions

type SearchOptions struct {

	// Max is used to stop the search after it finds Max number of results.
	// When Max is set to nil (or 0), all results are sought.
	Max *int

	// NoConcurrency can be set to ensure that results are stable (& reproducible).
	// This can be useful if the context is canceled or a Max is set.
	NoConcurrency bool

	// R is used to limit the range of the Series for search purposes.
	R *dataframe.Range

	// DontLock can be set to true if the Series should not be locked.
	DontLock bool
}

SearchOptions modifies the behavior of Search.

type ShuffleOptions

type ShuffleOptions struct {

	// R is used to limit the range of the Series for search purposes.
	R *dataframe.Range

	// DontLock can be set to true if the Series should not be locked.
	DontLock bool
}

ShuffleOptions modifies the behavior of Shuffle.

Directories

Path Synopsis
Package faker can be used to generate DataFrames filled with fake data.
Package faker can be used to generate DataFrames filled with fake data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL