Select

Rows

Select.first_() → pandas.core.series.Series

Select the first row

Returns:the first row as a serie
Return type:pd.Series
Select.limit(r: int = 5)

Limit selection to a range in the main dataframe

Parameters:r (int, optional) – number of rows to keep, defaults to 5
Select.limit_(r: int = 5) → Ds

Returns a DataSwim instance with limited selection

Returns:a Ds instance
Return type:Ds
Select.unique_(col: str) → list

Returns unique values in a column

Parameters:col (str) – the column to select from
Returns:a list of unique values in the column
Return type:list
Select.wunique_(col)

Weight unique values: returns a dataframe with a count of unique values

Select.subset(*args)

Set the main dataframe to a subset based in positions Select a subset of the main dataframe based on position: ex: ds.subset(0,10) or ds.subset(10) is equivalent: it starts at the first row if only one argument is provided

Select.subset_(*args)

Returns a Dataswim instance with a subset data based in positions Select a subset of the main dataframe based on position: ex: ds.subset(0,10) or ds.subset(10) is equivalent: it starts at the first row if only one argument is provided

From dates

Select.nowrange(col: str, timeframe: str)

Set the main dataframe with rows within a date range from now

Parameters:
  • col (str) – the column to use for range
  • timeframe (str) – units are: S, H, D, W, M, Y

example: ds.nowrange("Date", "3D")

Select.nowrange_(col: str, timeframe: str) → Ds

Returns a Dataswim instance with rows within a date range from now

Parameters:
  • col (str) – the column to use for range
  • timeframe (str) – units are: S, H, D, W, M, Y
Returns:

[description]

Return type:

[type]

example: ds2 = ds.nowrange_("Date", "3D")

Select.daterange(datecol: str, date_start: datetime.datetime, op: str, **args)

Set the main dataframe rows in a date range

Parameters:
  • datecol (str) – the column to use for range
  • date_start (datetime.datetime) – the date to start from
  • op (str) –
    • or -
Select.daterange_(datecol: str, date_start: datetime.datetime, op: str, **args) → Ds

Returns a DataSwim instance with rows in a date range

Parameters:
  • datecol (str) – the column to use for range
  • date_start (datetime.datetime) – the date to start from
  • op (str) –
    • or -
Returns:

a dataswim instance

Return type:

Ds