Keep
Source¶
Bases: Enum
Which row of a group of duplicated rows is kept, used by Deduplication.
Added in version 0.1.0
Examples:
import numdaplot as ndp
cities = ndp.Array.from_list(["Paris", "Lyon", "Paris"])
prices = ndp.Array.from_list([120.0, 80.0, 150.0])
sales = ndp.Table.from_arrays({"city": cities, "price": prices})
sales.drop_duplicates(ndp.Deduplication(columns=["city"], keep=ndp.Keep.LAST))
# city price
# TEXT FLOAT64
# 0 Lyon 80.0
# 1 Paris 150.0
sales.drop_duplicates(ndp.Deduplication(columns=["city"], keep=ndp.Keep.NONE))
# city price
# TEXT FLOAT64
# 0 Lyon 80.0
Attributes¶
FIRST = auto()
Source¶
The first row of each group is kept. Default value.
Added in version 0.1.0
Examples:
import numdaplot as ndp
cities = ndp.Array.from_list(["Paris", "Lyon", "Paris"])
prices = ndp.Array.from_list([120.0, 80.0, 150.0])
sales = ndp.Table.from_arrays({"city": cities, "price": prices})
sales.drop_duplicates(ndp.Deduplication(columns=["city"], keep=ndp.Keep.FIRST))
# city price
# TEXT FLOAT64
# 0 Paris 120.0
# 1 Lyon 80.0
LAST = auto()
Source¶
The last row of each group is kept.
Added in version 0.1.0
Examples:
import numdaplot as ndp
cities = ndp.Array.from_list(["Paris", "Lyon", "Paris"])
prices = ndp.Array.from_list([120.0, 80.0, 150.0])
sales = ndp.Table.from_arrays({"city": cities, "price": prices})
sales.drop_duplicates(ndp.Deduplication(columns=["city"], keep=ndp.Keep.LAST))
# city price
# TEXT FLOAT64
# 0 Lyon 80.0
# 1 Paris 150.0
NONE = auto()
Source¶
No row of a duplicated group is kept, only rows that appear once remain.
Added in version 0.1.0
Examples:
import numdaplot as ndp
cities = ndp.Array.from_list(["Paris", "Lyon", "Paris"])
prices = ndp.Array.from_list([120.0, 80.0, 150.0])
sales = ndp.Table.from_arrays({"city": cities, "price": prices})
sales.drop_duplicates(ndp.Deduplication(columns=["city"], keep=ndp.Keep.NONE))
# city price
# TEXT FLOAT64
# 0 Lyon 80.0