RowGet
Modifies the dataframe to only contain rows according to one of the following:
- Rows at specified indexes
- Rows that start from an index and go to a second index
- Rows that meet a specified criteria
- Rows that have missing data
- Rows that do not have missing data
- Rows at specified indexes
- Rows that start from an index and go to a second index
- Rows that meet a specified criteria
- Rows that have missing data
- Rows that do not have missing data
Options
columns: Specifies columns to retrieve rows, use with either --missing or --notMissing
where: Specifies a condition for retrieving rows
index: Specifies the index for retrieving rows
indexStart: Specifies the start index for retrieving rows
indexStop: Specifies the stop index for retrieving rows
missing: Specifies whether to retrieve rows where columns are missing
notMissing: Specifies whether to retrieve rows where columns are not missing
Examples
Example 1 - Get a Row at an Index
When you want to get rows at soecified indexes, you can use RowGet with the index option to get the rows at the specified indexes. Here, we get the row at index 10.
#> RowGet --index 10
AFLEFT
pizzeriasDfRow10 = pizzeriasDf.iloc[10] AFRIGHT
Example 2 - Get Rows From One Index Up To a Second Index
Rather then only getting rows at only specified indexes,
#> RowGet --indexStart 20 --indexStop 30
AFLEFT
pizzeriasDfRowsFrom20To30 = pizzeriasDf.iloc[20:30] AFRIGHT
Example 3
#> RowGet --indexStart 200
AFLEFT
pizzeriasDfRowsStartingAt200 = pizzeriasDf.iloc[200:] AFRIGHT
Example 4
#> RowGet --indexStop 30
AFLEFT
pizzeriasDfRowsStoppingAt30 = pizzeriasDf.iloc[:30] AFRIGHT
Example 5
#> RowGet --where Location contains Queens
AFLEFT
pizzeriasDf = pizzeriasDf[pizzeriasDf['Location'].astype('str').str.contains('Queens').fillna(False)] AFRIGHT