From 91cf4f5c920ffab9c8af84cba14322bd047d59f0 Mon Sep 17 00:00:00 2001 From: Jose Angel Hernao Date: Fri, 10 Sep 2021 15:03:16 -0500 Subject: [PATCH 1/4] Add date tests --- tests/creators/creator_date.py | 101 +++++++ tests/test_created__date.py | 477 +++++++++++++++++++++++++++++++++ 2 files changed, 578 insertions(+) create mode 100644 tests/creators/creator_date.py create mode 100644 tests/test_created__date.py diff --git a/tests/creators/creator_date.py b/tests/creators/creator_date.py new file mode 100644 index 000000000..3cdd4958a --- /dev/null +++ b/tests/creators/creator_date.py @@ -0,0 +1,101 @@ +import datetime +import sys +sys.path.append("../..") + + +def create(): + from optimus import Optimus + from optimus.tests.creator import TestCreator, default_configs + + op = Optimus("pandas") + df = op.create.dataframe({ + 'date arrival': ["Sat Sep 30 2023 11:38:11 -0400", "Mon May 1 2021 13:25:51 -0400", "Sun Aug 30 2021 00:00:01 -0400", "Fri Dec 31 1999 23:59:59 -0400", "Wednesday Jan 15 2038 10:30:19 -0400", "Tue Jul 31 1956 12:00:00 -0400"], + 'some date': ["Fri Dec 31 1999 23:59:59 -0400", "Wednesday Jan 15 2038 10:30:19 -0400", "Mon May 1 2021 13:25:51 -0400", "Sat Sep 30 2023 11:38:11 -0400", "Tue Jul 31 1956 12:00:00 -0400", "Sun Aug 30 2021 00:00:01 -0400"], + ('last date seen', 'date'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', "2000/05/12"], + ('Date Type'): [datetime.datetime(2016, 9, 10), datetime.datetime(2015, 8, 10), datetime.datetime(2020, 3, 1), datetime.datetime(2013, 6, 24), datetime.datetime(2012, 5, 10), "2021/8/30"], + ('timestamp', 'time'): ['2014/12/24', datetime.datetime(2014, 6, 24, 15, 0), datetime.datetime(2014, 6, 24, 2, 12), datetime.datetime(2014, 6, 24, 23, 3, 59), "2021-04-05 17:38:11", datetime.datetime(2021, 9, 3, 0, 0, 1)], + }) + + t = TestCreator(op, df, name="date", configs=default_configs) + + t.create(method="cols.year", variant="all", cols="*") + t.create(method="cols.year", variant="single", cols=["date arrival"], format='%a %b %d %Y %H:%M:%S -%Y') + t.create(method="cols.year", variant="multiple", cols=["Date Type", "timestamp", "last date seen"], output_cols=["dt", "ts", "da"]) + + t.create(method="cols.month", variant="all", cols="*") + t.create(method="cols.month", variant="single", cols=["date arrival"], format='%a %b %d %Y %H:%M:%S -%Y') + t.create(method="cols.month", variant="multiple", cols=["Date Type", "timestamp", "last date seen"], output_cols=["dt", "ts", "da"]) + + t.create(method="cols.day", variant="all", cols="*") + t.create(method="cols.day", variant="single", cols=["date arrival"], format='%a %b %d %Y %H:%M:%S -%Y') + t.create(method="cols.day", variant="multiple", cols=["Date Type", "timestamp", "last date seen"], output_cols=["dt", "ts", "da"]) + + t.create(method="cols.hour", variant="all", cols="*") + t.create(method="cols.hour", variant="single", cols=["date arrival"], format='%a %b %d %Y %H:%M:%S -%Y') + t.create(method="cols.hour", variant="multiple", cols=["Date Type", "timestamp", "last date seen"], output_cols=["dt", "ts", "da"]) + + t.create(method="cols.minute", variant="all", cols="*") + t.create(method="cols.minute", variant="single", cols=["date arrival"], format='%a %b %d %Y %H:%M:%S -%Y') + t.create(method="cols.minute", variant="multiple", cols=["Date Type", "timestamp", "last date seen"], output_cols=["dt", "ts", "da"]) + + t.create(method="cols.second", variant="all", cols="*") + t.create(method="cols.second", variant="single", cols=["date arrival"], format='%a %b %d %Y %H:%M:%S -%Y') + t.create(method="cols.second", variant="multiple", cols=["Date Type", "timestamp", "last date seen"], output_cols=["dt", "ts", "da"]) + + t.create(method="cols.weekday", variant="all", cols="*") + t.create(method="cols.weekday", variant="single", cols=["date arrival"], format='%a %b %d %Y %H:%M:%S -%Y') + t.create(method="cols.weekday", variant="multiple", cols=["Date Type", "timestamp", "last date seen"], output_cols=["dt", "ts", "da"]) + + t.create(method="cols.years_between", variant="all", cols="*", value='2000-1-1', date_format='%Y-%d-%m', round=False) + t.create(method="cols.years_between", variant="all_today", cols="*", round="up") + t.create(method="cols.years_between", variant="single", cols=["date arrival"], value="Sat Sep 4 2021 10:05:39 -0400", date_format='%a %b %d %Y %H:%M:%S -%Y', round="down") + t.create(method="cols.years_between", variant="single_timezone", cols=["date arrival", "some date"], round="round") + t.create(method="cols.years_between", variant="multiple", cols=["Date Type", "timestamp", "last date seen"], value="29/02/2012", date_format='%d/%m/%Y', round="floor", output_cols=["dt", "ts", "da"]) + t.create(method="cols.years_between", variant="multiple_today", cols=["Date Type", "timestamp", "last date seen"], round="ceil", output_cols=["dt", "ts", "da"]) + + t.create(method="cols.months_between", variant="all", cols="*", value='2000-1-1', date_format='%Y-%d-%m', round=False) + t.create(method="cols.months_between", variant="all_today", cols="*", round="up") + t.create(method="cols.months_between", variant="single", cols=["date arrival"], value="Sat Sep 4 2021 10:05:39 -0400", date_format='%a %b %d %Y %H:%M:%S -%Y', round="down") + t.create(method="cols.months_between", variant="single_timezone", cols=["date arrival", "some date"], round="round") + t.create(method="cols.months_between", variant="multiple", cols=["Date Type", "timestamp", "last date seen"], value="29/02/2012", date_format='%d/%m/%Y', round="floor", output_cols=["dt", "ts", "da"]) + t.create(method="cols.months_between", variant="multiple_today", cols=["Date Type", "timestamp", "last date seen"], round="ceil", output_cols=["dt", "ts", "da"]) + + t.create(method="cols.days_between", variant="all", cols="*", value='2000-1-1', date_format='%Y-%d-%m', round=False) + t.create(method="cols.days_between", variant="all_today", cols="*", round="up") + t.create(method="cols.days_between", variant="single", cols=["date arrival"], value="Sat Sep 4 2021 10:05:39 -0400", date_format='%a %b %d %Y %H:%M:%S -%Y', round="down") + t.create(method="cols.days_between", variant="single_timezone", cols=["date arrival", "some date"], round="round") + t.create(method="cols.days_between", variant="multiple", cols=["Date Type", "timestamp", "last date seen"], value="29/02/2012", date_format='%d/%m/%Y', round="floor", output_cols=["dt", "ts", "da"]) + t.create(method="cols.days_between", variant="multiple_today", cols=["Date Type", "timestamp", "last date seen"], round="ceil", output_cols=["dt", "ts", "da"]) + + t.create(method="cols.hours_between", variant="all", cols="*", value='2000-1-1', date_format='%Y-%d-%m', round=False) + t.create(method="cols.hours_between", variant="all_today", cols="*", round="up") + t.create(method="cols.hours_between", variant="single", cols=["date arrival"], value="Sat Sep 4 2021 10:05:39 -0400", date_format='%a %b %d %Y %H:%M:%S -%Y', round="down") + t.create(method="cols.hours_between", variant="single_timezone", cols=["date arrival", "some date"], round="round") + t.create(method="cols.hours_between", variant="multiple", cols=["Date Type", "timestamp", "last date seen"], value="29/02/2012", date_format='%d/%m/%Y', round="floor", output_cols=["dt", "ts", "da"]) + t.create(method="cols.hours_between", variant="multiple_today", cols=["Date Type", "timestamp", "last date seen"], round="ceil", output_cols=["dt", "ts", "da"]) + + t.create(method="cols.minutes_between", variant="all", cols="*", value='2000-1-1', date_format='%Y-%d-%m', round=False) + t.create(method="cols.minutes_between", variant="all_today", cols="*", round="up") + t.create(method="cols.minutes_between", variant="single", cols=["date arrival"], value="Sat Sep 4 2021 10:05:39 -0400", date_format='%a %b %d %Y %H:%M:%S -%Y', round="down") + t.create(method="cols.minutes_between", variant="single_timezone", cols=["date arrival", "same date"], round="round") + t.create(method="cols.minutes_between", variant="multiple", cols=["Date Type", "timestamp", "last date seen"], value="29/02/2012", date_format='%d/%m/%Y', round="floor", output_cols=["dt", "ts", "da"]) + t.create(method="cols.minutes_between", variant="multiple_today", cols=["Date Type", "timestamp", "last date seen"], round="ceil", output_cols=["dt", "ts", "da"]) + + t.create(method="cols.seconds_between", variant="all", cols="*", value='2000-1-1', date_format='%Y-%d-%m', round=False) + t.create(method="cols.seconds_between", variant="all_today", cols="*", round="up") + t.create(method="cols.seconds_between", variant="single", cols=["date arrival"], value="Sat Sep 4 2021 10:05:39 -0400", date_format='%a %b %d %Y %H:%M:%S -%Y', round="down") + t.create(method="cols.seconds_between", variant="single_timezone", cols=["date arrival", "same date"], round="round") + t.create(method="cols.seconds_between", variant="multiple", cols=["Date Type", "timestamp", "last date seen"], value="29/02/2012", date_format='%d/%m/%Y', round="floor", output_cols=["dt", "ts", "da"]) + t.create(method="cols.seconds_between", variant="multiple_today", cols=["Date Type", "timestamp", "last date seen"], round="ceil", output_cols=["dt", "ts", "da"]) + + t.create(method="cols.date_format", variant="all", cols="*") + t.create(method="cols.date_format", variant="single", cols=["date arrival"]) + t.create(method="cols.date_format", variant="multiple", cols=["Date Type", "timestamp", "last date seen"]) + + t.create(method="cols.format_date", variant="all", cols="*", output_format='%d') + t.create(method="cols.format_date", variant="single", cols=["date arrival"], current_format='%a %b %d %Y %H:%M:%S -%Y', output_format='%d/%Y/%m') + t.create(method="cols.format_date", variant="multiple", cols=["Date Type", "timestamp", "last date seen"], output_format='%H:%M:%S', output_cols=["dt", "ts", "da"]) + + t.run() + +create() diff --git a/tests/test_created__date.py b/tests/test_created__date.py new file mode 100644 index 000000000..176388fc1 --- /dev/null +++ b/tests/test_created__date.py @@ -0,0 +1,477 @@ +import datetime +from optimus.tests.base import TestBase +from optimus.helpers.json import json_encoding +from optimus.helpers.functions import deep_sort, df_dicts_equal, results_equal + + +def Timestamp(t): + return datetime.datetime.strptime(t, "%Y-%m-%d %H:%M:%S") + + +nan = float("nan") +inf = float("inf") + + +class TestDatePandas(TestBase): + config = {'engine': 'pandas'} + dict = {('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')]} + maxDiff = None + + def test_cols_date_format_all(self): + df = self.df + result = df.cols.date_format(cols='*') + expected = {'date arrival': '%a %b %d %Y %H:%M:%S -%Y', 'some date': '%a %b %d %Y %H:%M:%S -%Y', 'last date seen': '%Y/%d/%m', 'Date Type': True, 'timestamp': True} + self.assertTrue(results_equal(result, expected, decimal=5, assertion=True)) + + def test_cols_date_format_multiple(self): + df = self.df + result = df.cols.date_format(cols=['Date Type', 'timestamp', 'last date seen']) + expected = {'Date Type': True, 'timestamp': True, 'last date seen': '%Y/%d/%m'} + self.assertTrue(results_equal(result, expected, decimal=5, assertion=True)) + + def test_cols_date_format_single(self): + df = self.df + result = df.cols.date_format(cols=['date arrival']) + expected = %a %b %d %Y %H:%M:%S -%Y + self.assertTrue(results_equal(result, expected, decimal=5, assertion=True)) + + def test_cols_day_all(self): + df = self.df + result = df.cols.day(cols='*') + expected = self.create_dataframe(dict={('date arrival', 'int64'): [30, 1, 30, 31, 15, 31], ('some date', 'int64'): [31, 15, 1, 30, 31, 30], ('last date seen', 'int64'): [9, 8, 12, 6, 5, 5], ('Date Type', 'int64'): [10, 10, 1, 24, 10, 30], ('timestamp', 'int64'): [24, 24, 24, 24, 5, 3]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_day_multiple(self): + df = self.df + result = df.cols.day(cols=['Date Type', 'timestamp', 'last date seen'], output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ("last date seen_['dt', 'ts', 'da']", 'int64'): [9, 8, 12, 6, 5, 5], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ("Date Type_['dt', 'ts', 'da']", 'int64'): [10, 10, 1, 24, 10, 30], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ("timestamp_['dt', 'ts', 'da']", 'int64'): [24, 24, 24, 24, 5, 3]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_day_single(self): + df = self.df + result = df.cols.day(cols=['date arrival'], format='%a %b %d %Y %H:%M:%S -%Y') + expected = self.create_dataframe(dict={('date arrival', 'int64'): [30, 1, 30, 31, 15, 31], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_days_between_all(self): + df = self.df + result = df.cols.days_between(cols='*', value='2000-1-1', date_format='%Y-%d-%m', round=False) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_days_between_all_today(self): + df = self.df + result = df.cols.days_between(cols='*', round='up') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_days_between_multiple(self): + df = self.df + result = df.cols.days_between(cols=['Date Type', 'timestamp', 'last date seen'], value='29/02/2012', date_format='%d/%m/%Y', round='floor', output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('da', 'float64'): [-1655.0, -1258.0, -3574.0, -467.0, -71.0, 4310.0], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('dt', 'float64'): [-1655.0, -1258.0, -2923.0, -481.0, -71.0, -3470.0], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ('ts', 'float64'): [-1029.0, -847.0, -847.0, -847.0, -3324.0, -3475.0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_days_between_multiple_today(self): + df = self.df + result = df.cols.days_between(cols=['Date Type', 'timestamp', 'last date seen'], round='ceil', output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('da', 'float64'): [1819.0, 2216.0, -100.0, 3007.0, 3403.0, 7784.0], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('dt', 'float64'): [1819.0, 2216.0, 551.0, 2993.0, 3403.0, 4.0], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ('ts', 'float64'): [2445.0, 2628.0, 2628.0, 2627.0, 151.0, 0.0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_days_between_single(self): + df = self.df + result = df.cols.days_between(cols=['date arrival'], value='Sat Sep 4 2021 10:05:39 -0400', date_format='%a %b %d %Y %H:%M:%S -%Y', round='down') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_days_between_single_timezone(self): + df = self.df + result = df.cols.days_between(cols=['date arrival', 'some date'], round='round') + expected = self.create_dataframe(dict={('date arrival', 'float64'): [-8674.0, 6102.0, -121.0, 8673.0, -29753.0, 23770.0], ('some date', 'float64'): [nan, nan, nan, nan, nan, nan], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_format_date_all(self): + df = self.df + result = df.cols.format_date(cols='*', output_format='%d') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_format_date_multiple(self): + df = self.df + result = df.cols.format_date(cols=['Date Type', 'timestamp', 'last date seen'], output_format='%H:%M:%S', output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ("last date seen_['dt', 'ts', 'da']", 'object'): ['00:00:00', '00:00:00', '00:00:00', '00:00:00', '00:00:00', '00:00:00'], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ("Date Type_['dt', 'ts', 'da']", 'object'): ['00:00:00', '00:00:00', '00:00:00', '00:00:00', '00:00:00', '00:00:00'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ("timestamp_['dt', 'ts', 'da']", 'object'): ['00:00:00', '15:00:00', '02:12:00', '23:03:59', '17:38:11', '00:00:01']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_format_date_single(self): + df = self.df + result = df.cols.format_date(cols=['date arrival'], current_format='%a %b %d %Y %H:%M:%S -%Y', output_format='%d/%Y/%m') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_hour_all(self): + df = self.df + result = df.cols.hour(cols='*') + expected = self.create_dataframe(dict={('date arrival', 'int64'): [11, 13, 0, 23, 10, 12], ('some date', 'int64'): [23, 10, 13, 11, 12, 0], ('last date seen', 'int64'): [0, 0, 0, 0, 0, 0], ('Date Type', 'int64'): [0, 0, 0, 0, 0, 0], ('timestamp', 'int64'): [0, 15, 2, 23, 17, 0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_hour_multiple(self): + df = self.df + result = df.cols.hour(cols=['Date Type', 'timestamp', 'last date seen'], output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ("last date seen_['dt', 'ts', 'da']", 'int64'): [0, 0, 0, 0, 0, 0], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ("Date Type_['dt', 'ts', 'da']", 'int64'): [0, 0, 0, 0, 0, 0], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ("timestamp_['dt', 'ts', 'da']", 'int64'): [0, 15, 2, 23, 17, 0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_hour_single(self): + df = self.df + result = df.cols.hour(cols=['date arrival'], format='%a %b %d %Y %H:%M:%S -%Y') + expected = self.create_dataframe(dict={('date arrival', 'int64'): [11, 13, 0, 23, 10, 12], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_hours_between_all(self): + df = self.df + result = df.cols.hours_between(cols='*', value='2000-1-1', date_format='%Y-%d-%m', round=False) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_hours_between_all_today(self): + df = self.df + result = df.cols.hours_between(cols='*', round='up') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_hours_between_multiple(self): + df = self.df + result = df.cols.hours_between(cols=['Date Type', 'timestamp', 'last date seen'], value='29/02/2012', date_format='%d/%m/%Y', round='floor', output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('da', 'float64'): [-39720.0, -30192.0, -85776.0, -11208.0, -1704.0, 103440.0], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('dt', 'float64'): [-39720.0, -30192.0, -70152.0, -11544.0, -1704.0, -83280.0], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ('ts', 'float64'): [-24696.0, -20319.0, -20307.0, -20328.0, -79770.0, -83377.0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_hours_between_multiple_today(self): + df = self.df + result = df.cols.hours_between(cols=['Date Type', 'timestamp', 'last date seen'], round='ceil', output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('da', 'float64'): [43675.0, 53203.0, -2381.0, 72187.0, 81691.0, 186835.0], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('dt', 'float64'): [43675.0, 53203.0, 13243.0, 71851.0, 81691.0, 115.0], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ('ts', 'float64'): [58699.0, 63076.0, 63089.0, 63068.0, 3626.0, 19.0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_hours_between_single(self): + df = self.df + result = df.cols.hours_between(cols=['date arrival'], value='Sat Sep 4 2021 10:05:39 -0400', date_format='%a %b %d %Y %H:%M:%S -%Y', round='down') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_hours_between_single_timezone(self): + df = self.df + result = df.cols.hours_between(cols=['date arrival', 'some date'], round='round') + expected = self.create_dataframe(dict={('date arrival', 'float64'): [-208164.0, 146469.0, -2891.0, 208164.0, -714071.0, 570492.0], ('some date', 'float64'): [nan, nan, nan, nan, nan, nan], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_minute_all(self): + df = self.df + result = df.cols.minute(cols='*') + expected = self.create_dataframe(dict={('date arrival', 'int64'): [38, 25, 0, 59, 30, 0], ('some date', 'int64'): [59, 30, 25, 38, 0, 0], ('last date seen', 'int64'): [0, 0, 0, 0, 0, 0], ('Date Type', 'int64'): [0, 0, 0, 0, 0, 0], ('timestamp', 'int64'): [0, 0, 12, 3, 38, 0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_minute_multiple(self): + df = self.df + result = df.cols.minute(cols=['Date Type', 'timestamp', 'last date seen'], output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ("last date seen_['dt', 'ts', 'da']", 'int64'): [0, 0, 0, 0, 0, 0], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ("Date Type_['dt', 'ts', 'da']", 'int64'): [0, 0, 0, 0, 0, 0], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ("timestamp_['dt', 'ts', 'da']", 'int64'): [0, 0, 12, 3, 38, 0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_minute_single(self): + df = self.df + result = df.cols.minute(cols=['date arrival'], format='%a %b %d %Y %H:%M:%S -%Y') + expected = self.create_dataframe(dict={('date arrival', 'int64'): [38, 25, 0, 59, 30, 0], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_minutes_between_all(self): + df = self.df + result = df.cols.minutes_between(cols='*', value='2000-1-1', date_format='%Y-%d-%m', round=False) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_minutes_between_all_today(self): + df = self.df + result = df.cols.minutes_between(cols='*', round='up') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_minutes_between_multiple(self): + df = self.df + result = df.cols.minutes_between(cols=['Date Type', 'timestamp', 'last date seen'], value='29/02/2012', date_format='%d/%m/%Y', round='floor', output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('da', 'float64'): [-2383200.0, -1811520.0, -5146560.0, -672480.0, -102240.0, 6206400.0], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('dt', 'float64'): [-2383200.0, -1811520.0, -4209120.0, -692640.0, -102240.0, -4996800.0], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ('ts', 'float64'): [-1481760.0, -1219140.0, -1218372.0, -1219624.0, -4786179.0, -5002561.0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_minutes_between_multiple_today(self): + df = self.df + result = df.cols.minutes_between(cols=['Date Type', 'timestamp', 'last date seen'], round='ceil', output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('da', 'float64'): [2620493.0, 3192173.0, -142867.0, 4331213.0, 4901453.0, 11210093.0], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('dt', 'float64'): [2620493.0, 3192173.0, 794573.0, 4311053.0, 4901453.0, 6893.0], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ('ts', 'float64'): [3521933.0, 3784553.0, 3785321.0, 3784069.0, 217515.0, 1133.0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_minutes_between_single(self): + df = self.df + result = df.cols.minutes_between(cols=['date arrival'], value='Sat Sep 4 2021 10:05:39 -0400', date_format='%a %b %d %Y %H:%M:%S -%Y', round='down') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_minutes_between_single_timezone(self): + df = self.df + result = df.cols.minutes_between(cols=['date arrival', 'same date'], round='round') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_month_all(self): + df = self.df + result = df.cols.month(cols='*') + expected = self.create_dataframe(dict={('date arrival', 'int64'): [9, 5, 8, 12, 1, 7], ('some date', 'int64'): [12, 1, 5, 9, 7, 8], ('last date seen', 'int64'): [10, 10, 12, 10, 10, 12], ('Date Type', 'int64'): [9, 8, 3, 6, 5, 8], ('timestamp', 'int64'): [12, 6, 6, 6, 4, 9]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_month_multiple(self): + df = self.df + result = df.cols.month(cols=['Date Type', 'timestamp', 'last date seen'], output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ("last date seen_['dt', 'ts', 'da']", 'int64'): [10, 10, 12, 10, 10, 12], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ("Date Type_['dt', 'ts', 'da']", 'int64'): [9, 8, 3, 6, 5, 8], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ("timestamp_['dt', 'ts', 'da']", 'int64'): [12, 6, 6, 6, 4, 9]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_month_single(self): + df = self.df + result = df.cols.month(cols=['date arrival'], format='%a %b %d %Y %H:%M:%S -%Y') + expected = self.create_dataframe(dict={('date arrival', 'int64'): [9, 5, 8, 12, 1, 7], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_months_between_all(self): + df = self.df + result = df.cols.months_between(cols='*', value='2000-1-1', date_format='%Y-%d-%m', round=False) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_months_between_all_today(self): + df = self.df + result = df.cols.months_between(cols='*', round='up') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_months_between_multiple(self): + df = self.df + result = df.cols.months_between(cols=['Date Type', 'timestamp', 'last date seen'], value='29/02/2012', date_format='%d/%m/%Y', round='floor', output_cols=['dt', 'ts', 'da']) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_months_between_multiple_today(self): + df = self.df + result = df.cols.months_between(cols=['Date Type', 'timestamp', 'last date seen'], round='ceil', output_cols=['dt', 'ts', 'da']) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_months_between_single(self): + df = self.df + result = df.cols.months_between(cols=['date arrival'], value='Sat Sep 4 2021 10:05:39 -0400', date_format='%a %b %d %Y %H:%M:%S -%Y', round='down') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_months_between_single_timezone(self): + df = self.df + result = df.cols.months_between(cols=['date arrival', 'some date'], round='round') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_second_all(self): + df = self.df + result = df.cols.second(cols='*') + expected = self.create_dataframe(dict={('date arrival', 'int64'): [11, 51, 1, 59, 19, 0], ('some date', 'int64'): [59, 19, 51, 11, 0, 1], ('last date seen', 'int64'): [0, 0, 0, 0, 0, 0], ('Date Type', 'int64'): [0, 0, 0, 0, 0, 0], ('timestamp', 'int64'): [0, 0, 0, 59, 11, 1]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_second_multiple(self): + df = self.df + result = df.cols.second(cols=['Date Type', 'timestamp', 'last date seen'], output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ("last date seen_['dt', 'ts', 'da']", 'int64'): [0, 0, 0, 0, 0, 0], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ("Date Type_['dt', 'ts', 'da']", 'int64'): [0, 0, 0, 0, 0, 0], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ("timestamp_['dt', 'ts', 'da']", 'int64'): [0, 0, 0, 59, 11, 1]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_second_single(self): + df = self.df + result = df.cols.second(cols=['date arrival'], format='%a %b %d %Y %H:%M:%S -%Y') + expected = self.create_dataframe(dict={('date arrival', 'int64'): [11, 51, 1, 59, 19, 0], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_seconds_between_all(self): + df = self.df + result = df.cols.seconds_between(cols='*', value='2000-1-1', date_format='%Y-%d-%m', round=False) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_seconds_between_all_today(self): + df = self.df + result = df.cols.seconds_between(cols='*', round='up') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_seconds_between_multiple(self): + df = self.df + result = df.cols.seconds_between(cols=['Date Type', 'timestamp', 'last date seen'], value='29/02/2012', date_format='%d/%m/%Y', round='floor', output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('da', 'float64'): [-142992000.0, -108691200.0, -308793600.0, -40348800.0, -6134400.0, 372384000.0], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('dt', 'float64'): [-142992000.0, -108691200.0, -252547200.0, -41558400.0, -6134400.0, -299808000.0], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ('ts', 'float64'): [-88905600.0, -73148400.0, -73102320.0, -73177439.0, -287170691.0, -300153601.0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_seconds_between_multiple_today(self): + df = self.df + result = df.cols.seconds_between(cols=['Date Type', 'timestamp', 'last date seen'], round='ceil', output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('da', 'float64'): [157229567.0, 191530367.0, -8572033.0, 259872767.0, 294087167.0, 672605567.0], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('dt', 'float64'): [157229567.0, 191530367.0, 47674367.0, 258663167.0, 294087167.0, 413567.0], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ('ts', 'float64'): [211315967.0, 227073167.0, 227119247.0, 227044128.0, 13050876.0, 67966.0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_seconds_between_single(self): + df = self.df + result = df.cols.seconds_between(cols=['date arrival'], value='Sat Sep 4 2021 10:05:39 -0400', date_format='%a %b %d %Y %H:%M:%S -%Y', round='down') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_seconds_between_single_timezone(self): + df = self.df + result = df.cols.seconds_between(cols=['date arrival', 'same date'], round='round') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_weekday_all(self): + df = self.df + result = df.cols.weekday(cols='*') + expected = self.create_dataframe(dict={('date arrival', 'int64'): [5, 5, 0, 4, 4, 1], ('some date', 'int64'): [4, 4, 5, 5, 1, 0], ('last date seen', 'int64'): [6, 3, 6, 6, 4, 1], ('Date Type', 'int64'): [5, 0, 6, 0, 3, 0], ('timestamp', 'int64'): [2, 1, 1, 1, 0, 4]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_weekday_multiple(self): + df = self.df + result = df.cols.weekday(cols=['Date Type', 'timestamp', 'last date seen'], output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ("last date seen_['dt', 'ts', 'da']", 'int64'): [6, 3, 6, 6, 4, 1], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ("Date Type_['dt', 'ts', 'da']", 'int64'): [5, 0, 6, 0, 3, 0], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ("timestamp_['dt', 'ts', 'da']", 'int64'): [2, 1, 1, 1, 0, 4]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_weekday_single(self): + df = self.df + result = df.cols.weekday(cols=['date arrival'], format='%a %b %d %Y %H:%M:%S -%Y') + expected = self.create_dataframe(dict={('date arrival', 'int64'): [5, 5, 0, 4, 4, 1], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_year_all(self): + df = self.df + result = df.cols.year(cols='*') + expected = self.create_dataframe(dict={('date arrival', 'int64'): [2023, 2021, 2021, 1999, 2038, 1956], ('some date', 'int64'): [1999, 2038, 2021, 2023, 1956, 2021], ('last date seen', 'int64'): [2016, 2015, 2021, 2013, 2012, 2000], ('Date Type', 'int64'): [2016, 2015, 2020, 2013, 2012, 2021], ('timestamp', 'int64'): [2014, 2014, 2014, 2014, 2021, 2021]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_year_multiple(self): + df = self.df + result = df.cols.year(cols=['Date Type', 'timestamp', 'last date seen'], output_cols=['dt', 'ts', 'da']) + expected = self.create_dataframe(dict={('date arrival', 'object'): ['Sat Sep 30 2023 11:38:11 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sun Aug 30 2021 00:00:01 -0400', 'Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Tue Jul 31 1956 12:00:00 -0400'], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ("last date seen_['dt', 'ts', 'da']", 'int64'): [2016, 2015, 2021, 2013, 2012, 2000], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ("Date Type_['dt', 'ts', 'da']", 'int64'): [2016, 2015, 2020, 2013, 2012, 2021], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')], ("timestamp_['dt', 'ts', 'da']", 'int64'): [2014, 2014, 2014, 2014, 2021, 2021]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_year_single(self): + df = self.df + result = df.cols.year(cols=['date arrival'], format='%a %b %d %Y %H:%M:%S -%Y') + expected = self.create_dataframe(dict={('date arrival', 'int64'): [2023, 2021, 2021, 1999, 2038, 1956], ('some date', 'object'): ['Fri Dec 31 1999 23:59:59 -0400', 'Wednesday Jan 15 2038 10:30:19 -0400', 'Mon May 1 2021 13:25:51 -0400', 'Sat Sep 30 2023 11:38:11 -0400', 'Tue Jul 31 1956 12:00:00 -0400', 'Sun Aug 30 2021 00:00:01 -0400'], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2021/12/12', '2013/06/10', '2012/05/10', '2000/05/12'], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2020-03-01 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2021-08-30 00:00:00')], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-12-24 00:00:00'), Timestamp('2014-06-24 15:00:00'), Timestamp('2014-06-24 02:12:00'), Timestamp('2014-06-24 23:03:59'), Timestamp('2021-04-05 17:38:11'), Timestamp('2021-09-03 00:00:01')]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_years_between_all(self): + df = self.df + result = df.cols.years_between(cols='*', value='2000-1-1', date_format='%Y-%d-%m', round=False) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_years_between_all_today(self): + df = self.df + result = df.cols.years_between(cols='*', round='up') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_years_between_multiple(self): + df = self.df + result = df.cols.years_between(cols=['Date Type', 'timestamp', 'last date seen'], value='29/02/2012', date_format='%d/%m/%Y', round='floor', output_cols=['dt', 'ts', 'da']) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_years_between_multiple_today(self): + df = self.df + result = df.cols.years_between(cols=['Date Type', 'timestamp', 'last date seen'], round='ceil', output_cols=['dt', 'ts', 'da']) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_years_between_single(self): + df = self.df + result = df.cols.years_between(cols=['date arrival'], value='Sat Sep 4 2021 10:05:39 -0400', date_format='%a %b %d %Y %H:%M:%S -%Y', round='down') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_cols_years_between_single_timezone(self): + df = self.df + result = df.cols.years_between(cols=['date arrival', 'some date'], round='round') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + +class TestDateDask(TestDatePandas): + config = {'engine': 'dask', 'n_partitions': 1} + + +class TestDatePartitionDask(TestDatePandas): + config = {'engine': 'dask', 'n_partitions': 2} + + +try: + import cudf # pyright: reportMissingImports=false +except: + pass +else: + class TestDateCUDF(TestDatePandas): + config = {'engine': 'cudf'} + + +try: + import dask_cudf # pyright: reportMissingImports=false +except: + pass +else: + class TestDateDC(TestDatePandas): + config = {'engine': 'dask_cudf', 'n_partitions': 1} + + +try: + import dask_cudf # pyright: reportMissingImports=false +except: + pass +else: + class TestDatePartitionDC(TestDatePandas): + config = {'engine': 'dask_cudf', 'n_partitions': 2} + + +try: + import pyspark # pyright: reportMissingImports=false +except: + pass +else: + class TestDateSpark(TestDatePandas): + config = {'engine': 'spark'} + + +try: + import vaex # pyright: reportMissingImports=false +except: + pass +else: + class TestDateVaex(TestDatePandas): + config = {'engine': 'vaex'} From 28864165a0b3bf8c756a83586c30ee829eaa700b Mon Sep 17 00:00:00 2001 From: Jose Angel Hernao Date: Fri, 10 Sep 2021 16:05:33 -0500 Subject: [PATCH 2/4] Add load tests --- tests/test_load.py | 42 ++++++++++++++++++++++++------------------ tests/test_load_csv.py | 23 ++++++++++++++++++++--- 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/tests/test_load.py b/tests/test_load.py index 9b069b26d..a14fc709a 100644 --- a/tests/test_load.py +++ b/tests/test_load.py @@ -4,109 +4,115 @@ class TestLoadPandas(TestBase): def test_json(self): - df = self.load_dataframe("examples/data/foo.json", type="json", multiline=True) + df = self.load_dataframe("../../examples/data/foo.json", type="json", multiline=True) self.assertEqual(df.rows.count(), 19) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_json_less_rows(self): - df = self.load_dataframe("examples/data/foo.json", type="json", n_rows=13) + df = self.load_dataframe("../../examples/data/foo.json", type="json", n_rows=13) self.assertEqual(df.rows.count(), 13) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_json_more_rows(self): - df = self.load_dataframe("examples/data/foo.json", type="json", n_rows=50) + df = self.load_dataframe("../../examples/data/foo.json", type="json", n_rows=50) self.assertLess(df.rows.count(), 50) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) + def test_json_multiline(self): + df = self.load_dataframe("../../examples/data/foo.json", type="json", multiline=True) + self.assertEqual(df.rows.count(), 19) + self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) + self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) + def test_xml(self): - df = self.load_dataframe("examples/data/foo.xml", type="xml") + df = self.load_dataframe("../../examples/data/foo.xml", type="xml") self.assertEqual(df.rows.count(), 19) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_xml_less_rows(self): - df = self.load_dataframe("examples/data/foo.xml", type="xml", n_rows=13) + df = self.load_dataframe("../../examples/data/foo.xml", type="xml", n_rows=13) self.assertEqual(df.rows.count(), 13) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_xml_more_rows(self): - df = self.load_dataframe("examples/data/foo.xml", type="xml", n_rows=50) + df = self.load_dataframe("../../examples/data/foo.xml", type="xml", n_rows=50) self.assertLess(df.rows.count(), 50) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_parquet(self): - df = self.load_dataframe("examples/data/foo.parquet", type="parquet") + df = self.load_dataframe("../../examples/data/foo.parquet", type="parquet") self.assertEqual(df.rows.count(), 19) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_parquet_less_rows(self): - df = self.load_dataframe("examples/data/foo.parquet", type="parquet", n_rows=13) + df = self.load_dataframe("../../examples/data/foo.parquet", type="parquet", n_rows=13) self.assertEqual(df.rows.count(), 13) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_parquet_more_rows(self): - df = self.load_dataframe("examples/data/foo.parquet", type="parquet", n_rows=50) + df = self.load_dataframe("../../examples/data/foo.parquet", type="parquet", n_rows=50) self.assertLess(df.rows.count(), 50) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_avro(self): - df = self.load_dataframe("examples/data/foo.avro", type="avro") + df = self.load_dataframe("../../examples/data/foo.avro", type="avro") self.assertEqual(df.rows.count(), 19) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_avro_less_rows(self): - df = self.load_dataframe("examples/data/foo.avro", type="avro", n_rows=13) + df = self.load_dataframe("../../examples/data/foo.avro", type="avro", n_rows=13) self.assertEqual(df.rows.count(), 13) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_avro_more_rows(self): - df = self.load_dataframe("examples/data/foo.avro", type="avro", n_rows=50) + df = self.load_dataframe("../../examples/data/foo.avro", type="avro", n_rows=50) self.assertLess(df.rows.count(), 50) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_tsv(self): - df = self.load_dataframe("examples/data/foo.tsv", type="tsv") + df = self.load_dataframe("../../examples/data/foo.tsv", type="tsv") self.assertEqual(df.rows.count(), 5) self.assertEqual(df.cols.names(), ["Sepal length", "Sepal width", "Petal length", "Petal width", "Species"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_tsv_less_rows(self): - df = self.load_dataframe("examples/data/foo.tsv", type="tsv", n_rows=3) + df = self.load_dataframe("../../examples/data/foo.tsv", type="tsv", n_rows=3) self.assertEqual(df.rows.count(), 3) self.assertEqual(df.cols.names(), ["Sepal length", "Sepal width", "Petal length", "Petal width", "Species"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_tsv_more_rows(self): - df = self.load_dataframe("examples/data/foo.tsv", type="tsv", n_rows=50) + df = self.load_dataframe("../../examples/data/foo.tsv", type="tsv", n_rows=50) self.assertLess(df.rows.count(), 50) self.assertEqual(df.cols.names(), ["Sepal length", "Sepal width", "Petal length", "Petal width", "Species"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_xls(self): - df = self.load_dataframe("examples/data/titanic3.xls", type="excel") + df = self.load_dataframe("../../examples/data/titanic3.xls", type="excel") self.assertEqual(df.rows.count(), 1309) self.assertEqual(df.cols.names(), ["pclass", "survived", "name", "sex", "age", "sibsp", "parch", "ticket", "fare", "cabin", "embarked", "boat", "body", "home.dest"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_xls_less_rows(self): - df = self.load_dataframe("examples/data/titanic3.xls", type="excel", n_rows=13) + df = self.load_dataframe("../../examples/data/titanic3.xls", type="excel", n_rows=13) self.assertEqual(df.rows.count(), 13) self.assertEqual(df.cols.names(), ["pclass", "survived", "name", "sex", "age", "sibsp", "parch", "ticket", "fare", "cabin", "embarked", "boat", "body", "home.dest"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) def test_xls_more_rows(self): - df = self.load_dataframe("examples/data/titanic3.xls", type="excel", n_rows=50) + df = self.load_dataframe("../../examples/data/titanic3.xls", type="excel", n_rows=50) self.assertLess(df.rows.count(), 5000) self.assertEqual(df.cols.names(), ["pclass", "survived", "name", "sex", "age", "sibsp", "parch", "ticket", "fare", "cabin", "embarked", "boat", "body", "home.dest"]) self.assertEqual(self.config.get("n_partitions", 1), df.partitions()) diff --git a/tests/test_load_csv.py b/tests/test_load_csv.py index 55f337aec..26b78da5c 100644 --- a/tests/test_load_csv.py +++ b/tests/test_load_csv.py @@ -4,19 +4,36 @@ class TestCSVPandas(TestBase): def test_csv(self): - df = self.load_dataframe("examples/data/foo.csv") + df = self.load_dataframe("../../examples/data/foo.csv") self.assertEqual(df.rows.count(), 19) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) def test_csv_less_rows(self): - df = self.load_dataframe("examples/data/foo.csv", n_rows=13) + df = self.load_dataframe("../../examples/data/foo.csv", n_rows=13) self.assertEqual(df.rows.count(), 13) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) def test_csv_more_rows(self): - df = self.load_dataframe("examples/data/foo.csv", n_rows=50) + df = self.load_dataframe("../../examples/data/foo.csv", n_rows=50) self.assertLess(df.rows.count(), 50) self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) + + def test_csv_no_header(self): + df = self.load_dataframe("../../examples/data/foo.csv", header=None) + self.assertEqual(df.cols.names(), [0,1,2,3,4,5,6,7]) + + def test_csv_null(self): + df = self.load_dataframe("../../examples/data/foo.csv", null_value="null") + self.assertEqual(df.mask.null(cols='product').cols.frequency(), {'frequency': {'product': {'values': [{'value': False, 'count': 18}, + {'value': True, 'count': 1}]}}}) + + def test_csv_semicolon(self): + df = self.load_dataframe("../../exmaples/data/foo.csv", sep=";") + self.assertEqual(df.cols.names(), ['id,firstName,lastName,billingId,product,price,birth,dummyCol']) + + def test_csv_coma(self): + df = self.load_dataframe("../../exmaples/data/foo.csv", sep=",") + self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"]) class TestCSVDask(TestCSVPandas): config = {'engine': 'dask', 'n_partitions': 1} From 0c4513011fd1933bd9435967d243faa222132163 Mon Sep 17 00:00:00 2001 From: Jose Angel Hernao Date: Sat, 11 Sep 2021 14:38:24 -0500 Subject: [PATCH 3/4] Add row tests --- tests/creators/creator_rows.py | 599 ++++++++ tests/test_created__rows.py | 2541 ++++++++++++++++++++++++++++++++ 2 files changed, 3140 insertions(+) create mode 100644 tests/creators/creator_rows.py create mode 100644 tests/test_created__rows.py diff --git a/tests/creators/creator_rows.py b/tests/creators/creator_rows.py new file mode 100644 index 000000000..b11c96626 --- /dev/null +++ b/tests/creators/creator_rows.py @@ -0,0 +1,599 @@ +import datetime +import sys +sys.path.append("../..") + + +def create(): + from optimus import Optimus + from optimus.tests.creator import TestCreator, default_configs + + op = Optimus("pandas") + df = op.create.dataframe({ + 'NullType': [None, None, None, None, None, None], + 'attributes': [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], + 'date arrival': ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], + 'function(binary)': [bytearray('Leader', 'utf-8'), bytearray('Espionage', 'utf-8'), bytearray('Security', 'utf-8'), bytearray('First Lieutenant', 'utf-8'), bytearray('None', 'utf-8'), bytearray('Battle Station', 'utf-8')], + 'height(ft)': [-28, 17, 26, 13, None, 300], + 'japanese name': [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], + ('last date seen', 'date'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], + 'last position seen': ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], + 'rank': [10, 7, 7, 8, 10, 8], + ('Cybertronian', 'bool'): [True, True, True, True, True, False], + ('Date Type'): [datetime.datetime(2016, 9, 10), datetime.datetime(2015, 8, 10), datetime.datetime(2014, 6, 24), datetime.datetime(2013, 6, 24), datetime.datetime(2012, 5, 10), datetime.datetime(2011, 4, 10)], + ('age', 'int'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], + ('function', 'string'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], + ('names', 'str'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], + ('timestamp', 'time'): [datetime.datetime(2014, 6, 24, 0, 0), datetime.datetime(2014, 6, 24, 0, 0), datetime.datetime(2014, 6, 24, 0, 0), datetime.datetime(2014, 6, 24, 0, 0), datetime.datetime(2014, 6, 24, 0, 0), datetime.datetime(2014, 6, 24, 0, 0)], + ('weight(t)', 'float'): [4.3, 2.0, 4.0, 1.8, 5.7, None] + }) + + t = TestCreator(op, df, name="rows", configs=default_configs) + + df2 = op.load.csv("../../examples/data/foo.csv", n_rows=2) + df3 = op.create.dataframe({ + "email_test": ["an@example.com", "thisisatest@gmail.com", "somename@hotmail.com"], + "ip_test": ["192.0.2.1", "192.158.1.38", "192.168.136.52"]}) + + t.create(method="rows.append", variant="single_complete", dfs=[df2]) + t.create(method="rows.append", variant="single_some_cols", dfs=[df2], names_map={"First":["function","price"],"Second":["weight(t)","id"],"Third":["Cybertronian","birth"]}) + t.create(method="rows.append", variant="single_one_col", dfs=[df2], names_map={"Only":["japanese name","billingId"]}) + t.create(method="rows.append", variant="multiple_complete", dfs=[df2,df3]) + t.create(method="rows.append", variant="multiple_some_cols", dfs=[df2,df3], names_map={"First":["last position seen","product","ip_test"],"Second":["date arrival","firstName","object_test"],"Third":["names","lastName","email_test"]}) + t.create(method="rows.append", variant="multiple_one_col", dfs=[df2,df3], names_map={"Only":["attributes","dummyCol","object_test"]}) + + t.create(method="rows.count") + + t.create(method="rows.to_list", variant="all", input_cols="*") + t.create(method="rows.to_list", variant="single", input_cols=["names"]) + t.create(method="rows.to_list", variant="multiple", input_cols=["rank", "last date seen", "Cybertronian"]) + + t.create(method="rows.sort", variant="all_asc", cols="*", order="asc") + t.create(method="rows.sort", variant="all_desc", cols="*", order="desc") + t.create(method="rows.sort", variant="single_asc", cols=["names"], order="asc") + t.create(method="rows.sort", variant="single_desc", cols=["names"], order="desc") + t.create(method="rows.sort", variant="multiple_asc", cols=["rank", "last date seen", "Cybertronian"], order="asc") + t.create(method="rows.sort", variant="multiple_desc", cols=["rank", "last date seen", "Cybertronian"], order="desc") + + t.create(method="rows.reverse") + + t.create(method="rows.drop", variant="mask", where=df.mask.none("last position seen")) + t.create(method="rows.drop", variant="expression", where=df["height(ft)"]>15) + t.create(method="rows.drop", variant="col_name", where="Cybertronian") + + t.create(method="rows.between_index", variant="all", cols="*", lower_bound=0, upper_bound=1) + t.create(method="rows.between_index", variant="single", cols=["names"], lower_bound=4, upper_bound=4) + t.create(method="rows.between_index", variant="multiple", cols=["rank", "last date seen", "Cybertronian"], lower_bound=2, upper_bound=5) + + t.create(method="rows.limit", variant="less", count=2) + t.create(method="rows.limit", variant="equal", count=6) + t.create(method="rows.limit", variant="more", count=150) + + t.create(method="rows.approx_count") + + t.create(method="rows.str", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.str", variant="numeric", cols=["weight(t)"], drop=False, how="any") + t.create(method="rows.str", variant="string", cols=["function"], drop=True, how="all") + t.create(method="rows.str", variant="multiple", cols=["rank", "last date seen", "Cybertronian"], drop=False, how="all") + + t.create(method="rows.int", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.int", variant="numeric", cols=["weight(t)"], drop=False, how="any") + t.create(method="rows.int", variant="string", cols=["function"], drop=True, how="all") + t.create(method="rows.int", variant="multiple", cols=["rank", "last date seen", "Cybertronian"], drop=False, how="all") + + t.create(method="rows.float", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.float", variant="numeric", cols=["weight(t)"], drop=False, how="any") + t.create(method="rows.float", variant="string", cols=["function"], drop=True, how="all") + t.create(method="rows.float", variant="multiple", cols=["rank", "last date seen", "Cybertronian"], drop=False, how="all") + + t.create(method="rows.numeric", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.numeric", variant="numeric", cols=["weight(t)"], drop=False, how="any") + t.create(method="rows.numeric", variant="string", cols=["function"], drop=True, how="all") + t.create(method="rows.numeric", variant="multiple", cols=["rank", "last date seen", "Cybertronian"], drop=False, how="all") + + t.create(method="rows.greater_than", variant="all", cols="*", value=10, drop=True, how="any") + t.create(method="rows.greater_than", variant="numeric", cols=["height(ft)"], value=-0.31, drop=False, how="any") + t.create(method="rows.greater_than", variant="string", cols=["names"], value=0, drop=True, how="all") + t.create(method="rows.greater_than", variant="multiple", cols=["age", "NullType", "weight(t)"], value="-inf", drop=False, how="all") + + t.create(method="rows.greater_than_equal", variant="all", cols="*", value=10, drop=True, how="any") + t.create(method="rows.greater_than_equal", variant="numeric", cols=["height(ft)"], value=0.31, drop=False, how="any") + t.create(method="rows.greater_than_equal", variant="string", cols=["names"], value=0, drop=True, how="all") + t.create(method="rows.greater_than_equal", variant="multiple", cols=["age", "NullType", "weight(t)"], value="-inf", drop=False, how="all") + + t.create(method="rows.less_than", variant="all", cols="*", value=10, drop=True, how="any") + t.create(method="rows.less_than", variant="numeric", cols=["height(ft)"], value=0.31, drop=False, how="any") + t.create(method="rows.less_than", variant="string", cols=["names"], value=0, drop=True, how="all") + t.create(method="rows.less_than", variant="multiple", cols=["age", "NullType", "weight(t)"], value="inf", drop=False, how="all") + + t.create(method="rows.less_than_equal", variant="all", cols="*", value=10, drop=True, how="any") + t.create(method="rows.less_than_equal", variant="numeric", cols=["height(ft)"], value=0.31, drop=False, how="any") + t.create(method="rows.less_than_equal", variant="string", cols=["names"], value=0, drop=True, how="all") + t.create(method="rows.less_than_equal", variant="multiple", cols=["age", "NullType", "weight(t)"], value="inf", drop=False, how="all") + + t.create(method="rows.between", variant="all", cols="*", lower_bound="-inf", upper_bound="inf", equal=True, drop=True, how="any") + t.create(method="rows.between", variant="numeric", cols=["height(ft)"], bounds=[[26, -28]], equal=False, drop=False, how="any") + t.create(method="rows.between", variant="string", cols=["names"], upper_bound="-inf", lower_bound=0, equal=False, drop=True, how="all") + t.create(method="rows.between", variant="multiple", cols=["age", "NullType", "weight(t)"], bounds=[["-inf", -10], [0, 1.9999], [300, 5000000]], equal=True, drop=False, how="all") + + t.create(method="rows.equal", variant="all", cols="*", value=10, drop=True, how="any") + t.create(method="rows.equal", variant="numeric", cols=["height(ft)"], value=300, drop=False, how="any") + t.create(method="rows.equal", variant="string", cols=["function"], value="Leader", drop=True, how="all") + t.create(method="rows.equal", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], value=True, drop=False, how="all") + + t.create(method="rows.not_equal", variant="all", cols="*", value=10, drop=True, how="any") + t.create(method="rows.not_equal", variant="numeric", cols=["height(ft)"], value=300, drop=False, how="any") + t.create(method="rows.not_equal", variant="string", cols=["function"], value="Leader", drop=True, how="all") + t.create(method="rows.not_equal", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], value=True, drop=False, how="all") + + t.create(method="rows.missing", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.missing", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.missing", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.missing", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + t.create(method="rows.null", variant="all", cols="*", drop=True, how="all") + t.create(method="rows.null", variant="numeric", cols=["height(ft)"], drop=True, how="any") + t.create(method="rows.null", variant="string", cols=["names"], drop=False, how="all") + t.create(method="rows.null", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="any") + + t.create(method="rows.none", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.none", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.none", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.none", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + t.create(method="rows.nan", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.nan", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.nan", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.nan", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + t.create(method="rows.duplicated", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.duplicated", variant="all_first", cols="*", keep="first", drop=False, how="any") + t.create(method="rows.duplicated", variant="all_last", cols="*", keep="last", drop=True, how="all") + t.create(method="rows.duplicated", variant="numeric", cols=["rank"], drop=False, how="all") + t.create(method="rows.duplicated", variant="numeric_first", cols=["rank"], keep="first", drop=True, how="any") + t.create(method="rows.duplicated", variant="numeric_last", cols=["rank"], keep="last", drop=False, how="any") + t.create(method="rows.duplicated", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.duplicated", variant="string_first", cols=["names"], keep="first", drop=False, how="all") + t.create(method="rows.duplicated", variant="string_last", cols=["names"], keep="last", drop=True, how="any") + t.create(method="rows.duplicated", variant="multiple", cols=["NullType", "timestamp", "Cybertronian"], keep="first", drop=False, how="any") + t.create(method="rows.duplicated", variant="multiple_first", cols=["NullType", "timestamp", "Cybertronian"], keep="first", drop=True, how="all") + t.create(method="rows.duplicated", variant="multiple_last", cols=["NullType", "timestamp", "Cybertronian"], keep="first", drop=False, how="all") + + t.create(method="rows.unique", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.unique", variant="all_first", cols="*", keep="first", drop=False, how="any") + t.create(method="rows.unique", variant="all_last", cols="*", keep="last", drop=True, how="all") + t.create(method="rows.unique", variant="numeric", cols=["rank"], drop=False, how="all") + t.create(method="rows.unique", variant="numeric_first", cols=["rank"], keep="first", drop=True, how="any") + t.create(method="rows.unique", variant="numeric_last", cols=["rank"], keep="last", drop=False, how="any") + t.create(method="rows.unique", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.unique", variant="string_first", cols=["names"], keep="first", drop=False, how="all") + t.create(method="rows.unique", variant="string_last", cols=["names"], keep="last", drop=True, how="any") + t.create(method="rows.unique", variant="multiple", cols=["NullType", "timestamp", "Cybertronian"], keep="first", drop=False, how="any") + t.create(method="rows.unique", variant="multiple_first", cols=["NullType", "timestamp", "Cybertronian"], keep="first", drop=True, how="all") + t.create(method="rows.unique", variant="multiple_last", cols=["NullType", "timestamp", "Cybertronian"], keep="first", drop=False, how="all") + + t.create(method="rows.empty", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.empty", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.empty", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.empty", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + t.create(method="rows.value_in", variant="all", cols="*", values=[10, True, None, "Jazz"], drop=True, how="any") + t.create(method="rows.value_in", variant="numeric", cols=["height(ft)"], values=[300, "nan"], drop=False, how="any") + t.create(method="rows.value_in", variant="string", cols=["function"], values="Leader", drop=True, how="all") + t.create(method="rows.value_in", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], values=[False, None, 4], drop=False, how="all") + + t.create(method="rows.pattern", variant="all", cols="*", pattern="**cc**", drop=True, how="any") + t.create(method="rows.pattern", variant="numeric", cols=["height(ft)"], pattern="##!#", drop=False, how="any") + t.create(method="rows.pattern", variant="string", cols=["function"], pattern="Ullclc", drop=True, how="all") + t.create(method="rows.pattern", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], pattern="****", drop=False, how="all") + + t.create(method="rows.starts_with", variant="all", cols="*", value="N", drop=True, how="any") + t.create(method="rows.starts_with", variant="numeric", cols=["height(ft)"], value=1, drop=False, how="any") + t.create(method="rows.starts_with", variant="string", cols=["function"], value="Lead", drop=True, how="all") + t.create(method="rows.starts_with", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], value=True, drop=False, how="all") + + t.create(method="rows.ends_with", variant="all", cols="*", value="]", drop=True, how="any") + t.create(method="rows.ends_with", variant="numeric", cols=["height(ft)"], value=0, drop=False, how="any") + t.create(method="rows.ends_with", variant="string", cols=["function"], value="e", drop=True, how="all") + t.create(method="rows.ends_with", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], value="one", drop=False, how="all") + + t.create(method="rows.contains", variant="all", cols="*", value="a", drop=True, how="any") + t.create(method="rows.contains", variant="numeric", cols=["height(ft)"], value="0", drop=False, how="any") + t.create(method="rows.contains", variant="string", cols=["function"], value="Le", drop=True, how="all") + t.create(method="rows.contains", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], value="T", drop=False, how="all") + + t.create(method="rows.find", variant="all", cols="*", value="None", drop=True, how="any") + t.create(method="rows.find", variant="numeric", cols=["height(ft)"], value=13, drop=False, how="any") + t.create(method="rows.find", variant="string", cols=["function"], value="Leader", drop=True, how="all") + t.create(method="rows.find", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], value=1, drop=False, how="all") + + df2 = df.cols.append( + {"email_test": ["an@example.com", "thisisatest@gmail.com", "somename@hotmail.com", "an@outlook.com", "anexample@mail.com", "example@yahoo.com"]}) + + t.create(df=df2, method="rows.email", cols=["email_test"], drop=False, how="any") + t.create(method="rows.email", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.email", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.email", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.email", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + df2 = df.cols.append( + {"ip_test": ["192.0.2.1", "192.158.1.38", "192.168.136.52", "172.16.92.107", "10.63.215.5", "10.0.5.0"]}) + + t.create(df=df2, method="rows.ip", cols=["ip_test"], drop=False, how="any") + t.create(method="rows.ip", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.ip", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.ip", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.ip", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + df2 = df.cols.append( + {"urls_test": ["https://github.com/hi-primus/optimus", "localhost:3000?help=true", "http://www.images.hi-example.com:54/images.php#id?help=1&freq=2", "hi-optimus.com", "https://www.computerhope.com/cgi-bin/search.cgi?q=example%20search&example=test", "https://www.google.com/search?q=this+is+a+test&client=safari&sxsrf=ALe&source=hp&ei=NL0-y4&iflsig=AINF&oq=this+is+a+test&gs_lcp=MZgBAKA&sclient=gws-wiz&ved=0ah&uact=5"]}) + + t.create(df=df2, method="rows.url", cols=["urls_test"], drop=False, how="any") + t.create(method="rows.url", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.url", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.url", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.url", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + df2 = df.cols.append( + {"gender_test": ["male", "female", "Male", "5.0", "MALE", "FEMALE"]}) + + t.create(df=df2, method="rows.gender", cols=["gender_test"], drop=False, how="any") + t.create(method="rows.gender", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.gender", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.gender", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.gender", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + df2 = df.cols.append( + {"boolean_test": ["True", "False", True, False, 1, 0]}) + + t.create(df=df2, method="rows.boolean", cols=["boolean_test"], drop=False, how="any") + t.create(method="rows.boolean", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.boolean", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.boolean", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.boolean", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], drop=False, how="all") + + df2 = df.cols.append( + {"zip_code_test": [90210, 21252, 36104, 99801, 85001, 10]}) + + t.create(df=df2, method="rows.zip_code", cols=["zip_code_test"], drop=False, how="any") + t.create(method="rows.zip_code", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.zip_code", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.zip_code", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.zip_code", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + df2 = df.cols.append( + {"credit_card_number_test": ["2345 6362 6362 8632", 5692857295730750, "31028482204828450", "99 77 80 14 53 73 83 53", "8 5 0 0 1 5 8 1 5 8 3 7 0 0 0 1", 10]}) + + t.create(df=df2, method="rows.credit_card_number", cols=["credit_card_number_test"], drop=False, how="any") + t.create(method="rows.credit_card_number", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.credit_card_number", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.credit_card_number", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.credit_card_number", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + df2 = df.cols.append( + {"datetime_test": ['1980/04/10', '5.0', datetime.datetime(2016, 9, 10), datetime.datetime(2014, 6, 24, 0, 0), '2013/06/10', datetime.datetime(2011, 4, 10)]}) + + t.create(df=df2, method="rows.datetime", cols=["datetime_test"], drop=False, how="any") + t.create(method="rows.datetime", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.datetime", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.datetime", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.datetime", variant="multiple", cols=["Date Type", "last date seen", "timestamp"], drop=False, how="all") + + df2 = df.cols.append( + {"object_test": ['1980/04/10', True, None, float("inf"), "yes", "bytearray(12, 'utf-8')"]}) + + t.create(df=df2, method="rows.object", cols=["object_test"], drop=False, how="any") + t.create(method="rows.object", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.object", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.object", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.object", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + df2 = df.cols.append( + {"array_test": [[1, 2, 3, 4], [[1], [2, 3]], ["one", "two"], ["one", ["two", [float("-inf")]]], ["yes"], "bytearray(12, 'utf-8')"]}) + + t.create(df=df2, method="rows.array", cols=["array_test"], drop=False, how="any") + t.create(method="rows.array", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.array", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.array", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.array", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + df2 = df.cols.append( + {"phone_number_test": [5516528967, "55 8395 1284", "+52 55 3913 1941", "+1 (210) 589-6721", 12106920692, "5532592785"]}) + + t.create(df=df2, method="rows.phone_number", cols=["phone_number_test"], drop=False, how="any") + t.create(method="rows.phone_number", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.phone_number", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.phone_number", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.phone_number", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + df2 = df.cols.append( + {"social_security_number_test": [372847278, "551-83-1284", "525 93 1941", "230 89-6721", "121-069 2062", "371847288"]}) + + t.create(df=df2, method="rows.social_security_number", cols=["social_security_number_test"], drop=False, how="any") + t.create(method="rows.social_security_number", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.social_security_number", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.social_security_number", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.social_security_number", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + df2 = df.cols.append( + {"http_code_test": ["http://github.com/hi-primus/optimus", "localhost:3000?help=true", "http://www.images.hi-example.com:54/images.php#id?help=1&freq=2", "hi-optimus.com", "http://www.computerhope.com/cgi-bin/search.cgi?q=example%20search&example=test", "http://www.google.com/search?q=this+is+a+test&client=safari&sxsrf=ALe&source=hp&ei=NL0-y4&iflsig=AINF&oq=this+is+a+test&gs_lcp=MZgBAKA&sclient=gws-wiz&ved=0ah&uact=5"]}) + + t.create(df=df2, method="rows.http_code", cols=["http_code_test"], drop=False, how="any") + t.create(method="rows.http_code", variant="all", cols="*", drop=True, how="any") + t.create(method="rows.http_code", variant="numeric", cols=["height(ft)"], drop=False, how="any") + t.create(method="rows.http_code", variant="string", cols=["names"], drop=True, how="all") + t.create(method="rows.http_code", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], drop=False, how="all") + + t.create(method="rows.expression", variant="all_expression", cols="*", where='df["rank"]>8', drop=True, how="any") + t.create(method="rows.expression", variant="all_colname", where="last position seen", drop=False, how="any") + t.create(method="rows.expression", variant="numeric_expression", where='df["height(ft)"]>=0', drop=True, how="all") + t.create(method="rows.expression", variant="numeric_colname", where="height(ft)", drop=False, how="all") + t.create(method="rows.expression", variant="string_expression", where='df["function"]=="Leader"', drop=True, how="any") + t.create(method="rows.expression", variant="string_colname", where="function", drop=False, how="any") + t.create(method="rows.expression", variant="multiple_expression", where='df["Cybertronian"]==False', drop=True, how="all") + t.create(method="rows.expression", variant="multiple_colname", where="NullType", drop=False, how="all") + + t.create(method="rows.drop_str", variant="all", cols="*", how="any") + t.create(method="rows.drop_str", variant="numeric", cols=["weight(t)"], how="any") + t.create(method="rows.drop_str", variant="string", cols=["function"], how="all") + t.create(method="rows.drop_str", variant="multiple", cols=["rank", "last date seen", "Cybertronian"], how="all") + + t.create(method="rows.drop_int", variant="all", cols="*", how="any") + t.create(method="rows.drop_int", variant="numeric", cols=["weight(t)"], how="any") + t.create(method="rows.drop_int", variant="string", cols=["function"], how="all") + t.create(method="rows.drop_int", variant="multiple", cols=["rank", "last date seen", "Cybertronian"], how="all") + + t.create(method="rows.drop_float", variant="all", cols="*", how="any") + t.create(method="rows.drop_float", variant="numeric", cols=["weight(t)"], how="any") + t.create(method="rows.drop_float", variant="string", cols=["function"], how="all") + t.create(method="rows.drop_float", variant="multiple", cols=["rank", "last date seen", "Cybertronian"], how="all") + + t.create(method="rows.drop_numeric", variant="all", cols="*", how="any") + t.create(method="rows.drop_numeric", variant="numeric", cols=["weight(t)"], how="any") + t.create(method="rows.drop_numeric", variant="string", cols=["function"], how="all") + t.create(method="rows.drop_numeric", variant="multiple", cols=["rank", "last date seen", "Cybertronian"], how="all") + + t.create(method="rows.drop_greater_than", variant="all", cols="*", value=10, how="any") + t.create(method="rows.drop_greater_than", variant="numeric", cols=["height(ft)"], value=-0.31, how="any") + t.create(method="rows.drop_greater_than", variant="string", cols=["names"], value=0, how="all") + t.create(method="rows.drop_greater_than", variant="multiple", cols=["age", "NullType", "weight(t)"], value="-inf", how="all") + + t.create(method="rows.drop_greater_than_equal", variant="all", cols="*", value=10, how="any") + t.create(method="rows.drop_greater_than_equal", variant="numeric", cols=["height(ft)"], value=0.31, how="any") + t.create(method="rows.drop_greater_than_equal", variant="string", cols=["names"], value=0, how="all") + t.create(method="rows.drop_greater_than_equal", variant="multiple", cols=["age", "NullType", "weight(t)"], value="-inf", how="all") + + t.create(method="rows.drop_less_than", variant="all", cols="*", value=10, how="any") + t.create(method="rows.drop_less_than", variant="numeric", cols=["height(ft)"], value=0.31, how="any") + t.create(method="rows.drop_less_than", variant="string", cols=["names"], value=0, how="all") + t.create(method="rows.drop_less_than", variant="multiple", cols=["age", "NullType", "weight(t)"], value="inf", how="all") + + t.create(method="rows.drop_less_than_equal", variant="all", cols="*", value=10, how="any") + t.create(method="rows.drop_less_than_equal", variant="numeric", cols=["height(ft)"], value=0.31, how="any") + t.create(method="rows.drop_less_than_equal", variant="string", cols=["names"], value=0, how="all") + t.create(method="rows.drop_less_than_equal", variant="multiple", cols=["age", "NullType", "weight(t)"], value="inf", how="all") + + t.create(method="rows.drop_between", variant="all", cols="*", lower_bound="-inf", upper_bound="inf", equal=True, how="any") + t.create(method="rows.drop_between", variant="numeric", cols=["height(ft)"], bounds=[[26, -28]], equal=False, how="any") + t.create(method="rows.drop_between", variant="string", cols=["names"], upper_bound="-inf", lower_bound=0, equal=False, how="all") + t.create(method="rows.drop_between", variant="multiple", cols=["age", "NullType", "weight(t)"], bounds=[["-inf", -10], [0, 1.9999], [300, 5000000]], equal=True, how="all") + + t.create(method="rows.drop_equal", variant="all", cols="*", value=10, how="any") + t.create(method="rows.drop_equal", variant="numeric", cols=["height(ft)"], value=300, how="any") + t.create(method="rows.drop_equal", variant="string", cols=["function"], value="Leader", how="all") + t.create(method="rows.drop_equal", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], value=True, how="all") + + t.create(method="rows.drop_not_equal", variant="all", cols="*", value=10, how="any") + t.create(method="rows.drop_not_equal", variant="numeric", cols=["height(ft)"], value=300, how="any") + t.create(method="rows.drop_not_equal", variant="string", cols=["function"], value="Leader", how="all") + t.create(method="rows.drop_not_equal", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], value=True, how="all") + + t.create(method="rows.drop_missings", variant="all", cols="*", how="any") + t.create(method="rows.drop_missings", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_missings", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_missings", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + t.create(method="rows.drop_nulls", variant="all", cols="*", how="all") + t.create(method="rows.drop_nulls", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_nulls", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_nulls", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="any") + + t.create(method="rows.drop_none", variant="all", cols="*", how="any") + t.create(method="rows.drop_none", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_none", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_none", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + t.create(method="rows.drop_nan", variant="all", cols="*", how="any") + t.create(method="rows.drop_nan", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_nan", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_nan", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + t.create(method="rows.drop_duplicated", variant="all", cols="*", how="any") + t.create(method="rows.drop_duplicated", variant="all_first", cols="*", keep="first", how="any") + t.create(method="rows.drop_duplicated", variant="all_last", cols="*", keep="last", how="all") + t.create(method="rows.drop_duplicated", variant="numeric", cols=["rank"], how="all") + t.create(method="rows.drop_duplicated", variant="numeric_first", cols=["rank"], keep="first", how="any") + t.create(method="rows.drop_duplicated", variant="numeric_last", cols=["rank"], keep="last", how="any") + t.create(method="rows.drop_duplicated", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_duplicated", variant="string_first", cols=["names"], keep="first", how="all") + t.create(method="rows.drop_duplicated", variant="string_last", cols=["names"], keep="last", how="any") + t.create(method="rows.drop_duplicated", variant="multiple", cols=["NullType", "timestamp", "Cybertronian"], keep="first", how="any") + t.create(method="rows.drop_duplicated", variant="multiple_first", cols=["NullType", "timestamp", "Cybertronian"], keep="first", how="all") + t.create(method="rows.drop_duplicated", variant="multiple_last", cols=["NullType", "timestamp", "Cybertronian"], keep="first", how="all") + + t.create(method="rows.drop_uniques", variant="all", cols="*", how="any") + t.create(method="rows.drop_uniques", variant="all_first", cols="*", keep="first", how="any") + t.create(method="rows.drop_uniques", variant="all_last", cols="*", keep="last", how="all") + t.create(method="rows.drop_uniques", variant="numeric", cols=["rank"], how="all") + t.create(method="rows.drop_uniques", variant="numeric_first", cols=["rank"], keep="first", how="any") + t.create(method="rows.drop_uniques", variant="numeric_last", cols=["rank"], keep="last", how="any") + t.create(method="rows.drop_uniques", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_uniques", variant="string_first", cols=["names"], keep="first", how="all") + t.create(method="rows.drop_uniques", variant="string_last", cols=["names"], keep="last", how="any") + t.create(method="rows.drop_uniques", variant="multiple", cols=["NullType", "timestamp", "Cybertronian"], keep="first", how="any") + t.create(method="rows.drop_uniques", variant="multiple_first", cols=["NullType", "timestamp", "Cybertronian"], keep="first", how="all") + t.create(method="rows.drop_uniques", variant="multiple_last", cols=["NullType", "timestamp", "Cybertronian"], keep="first", how="all") + + t.create(method="rows.drop_empty", variant="all", cols="*", how="any") + t.create(method="rows.drop_empty", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_empty", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_empty", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + t.create(method="rows.drop_value_in", variant="all", cols="*", values=[10, True, None, "Jazz"], how="any") + t.create(method="rows.drop_value_in", variant="numeric", cols=["height(ft)"], values=[300, "nan"], how="any") + t.create(method="rows.drop_value_in", variant="string", cols=["function"], values="Leader", how="all") + t.create(method="rows.drop_value_in", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], values=[False, None, 4], how="all") + + t.create(method="rows.drop_pattern", variant="all", cols="*", pattern="**cc**", how="any") + t.create(method="rows.drop_pattern", variant="numeric", cols=["height(ft)"], pattern="##!#", how="any") + t.create(method="rows.drop_pattern", variant="string", cols=["function"], pattern="Ullclc", how="all") + t.create(method="rows.drop_pattern", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], pattern="****", how="all") + + t.create(method="rows.drop_starts_with", variant="all", cols="*", value="N", how="any") + t.create(method="rows.drop_starts_with", variant="numeric", cols=["height(ft)"], value=1, how="any") + t.create(method="rows.drop_starts_with", variant="string", cols=["function"], value="Lead", how="all") + t.create(method="rows.drop_starts_with", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], value=True, how="all") + + t.create(method="rows.drop_ends_with", variant="all", cols="*", value="]", how="any") + t.create(method="rows.drop_ends_with", variant="numeric", cols=["height(ft)"], value=0, how="any") + t.create(method="rows.drop_ends_with", variant="string", cols=["function"], value="e", how="all") + t.create(method="rows.drop_ends_with", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], value="one", how="all") + + t.create(method="rows.drop_contains", variant="all", cols="*", value="a", how="any") + t.create(method="rows.drop_contains", variant="numeric", cols=["height(ft)"], value="0", how="any") + t.create(method="rows.drop_contains", variant="string", cols=["function"], value="Le", how="all") + t.create(method="rows.drop_contains", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], value="T", how="all") + + t.create(method="rows.drop_find", variant="all", cols="*", value="None", how="any") + t.create(method="rows.drop_find", variant="numeric", cols=["height(ft)"], value=13, how="any") + t.create(method="rows.drop_find", variant="string", cols=["function"], value="Leader", how="all") + t.create(method="rows.drop_find", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], value=1, how="all") + + df2 = df.cols.append( + {"emails_test": ["an@example.com", "thisisatest@gmail.com", "somename@hotmail.com", "an@outlook.com", "anexample@mail.com", "example@yahoo.com"]}) + + t.create(df=df2, method="rows.drop_emails", cols=["emails_test"], how="any") + t.create(method="rows.drop_emails", variant="all", cols="*", how="any") + t.create(method="rows.drop_emails", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_emails", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_emails", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + df2 = df.cols.append( + {"ips_test": ["192.0.2.1", "192.158.1.38", "192.168.136.52", "172.16.92.107", "10.63.215.5", "10.0.5.0"]}) + + t.create(df=df2, method="rows.drop_ips", cols=["ips_test"], how="any") + t.create(method="rows.drop_ips", variant="all", cols="*", how="any") + t.create(method="rows.drop_ips", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_ips", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_ips", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + df2 = df.cols.append( + {"urls_test": ["https://github.com/hi-primus/optimus", "localhost:3000?help=true", "http://www.images.hi-example.com:54/images.php#id?help=1&freq=2", "hi-optimus.com", "https://www.computerhope.com/cgi-bin/search.cgi?q=example%20search&example=test", "https://www.google.com/search?q=this+is+a+test&client=safari&sxsrf=ALe&source=hp&ei=NL0-y4&iflsig=AINF&oq=this+is+a+test&gs_lcp=MZgBAKA&sclient=gws-wiz&ved=0ah&uact=5"]}) + + t.create(df=df2, method="rows.drop_urls", cols=["urls_test"], how="any") + t.create(method="rows.drop_urls", variant="all", cols="*", how="any") + t.create(method="rows.drop_urls", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_urls", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_urls", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + df2 = df.cols.append( + {"genders_test": ["male", "female", "Male", "5.0", "MALE", "FEMALE"]}) + + t.create(df=df2, method="rows.drop_genders", cols=["genders_test"], how="any") + t.create(method="rows.drop_genders", variant="all", cols="*", how="any") + t.create(method="rows.drop_genders", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_genders", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_genders", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + df2 = df.cols.append( + {"booleans_test": ["True", "False", True, False, 1, 0]}) + + t.create(df=df2, method="rows.drop_booleans", cols=["booleans_test"], how="any") + t.create(method="rows.drop_booleans", variant="all", cols="*", how="any") + t.create(method="rows.drop_booleans", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_booleans", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_booleans", variant="multiple", cols=["NullType", "weight(t)", "Cybertronian"], how="all") + + df2 = df.cols.append( + {"zip_codes_test": [90210, 21252, 36104, 99801, 85001, 10]}) + + t.create(df=df2, method="rows.drop_zip_codes", cols=["zip_codes_test"], how="any") + t.create(method="rows.drop_zip_codes", variant="all", cols="*", how="any") + t.create(method="rows.drop_zip_codes", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_zip_codes", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_zip_codes", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + df2 = df.cols.append( + {"credit_card_numbers_test": ["2345 6362 6362 8632", 5692857295730750, "31028482204828450", "99 77 80 14 53 73 83 53", "8 5 0 0 1 5 8 1 5 8 3 7 0 0 0 1", 10]}) + + t.create(df=df2, method="rows.drop_credit_card_numbers", cols=["credit_card_numbers_test"], how="any") + t.create(method="rows.drop_credit_card_numbers", variant="all", cols="*", how="any") + t.create(method="rows.drop_credit_card_numbers", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_credit_card_numbers", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_credit_card_numbers", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + df2 = df.cols.append( + {"datetimes_test": ['1980/04/10', '5.0', datetime.datetime(2016, 9, 10), datetime.datetime(2014, 6, 24, 0, 0), '2013/06/10', datetime.datetime(2011, 4, 10)]}) + + t.create(df=df2, method="rows.drop_datetimes", cols=["datetimes_test"], how="any") + t.create(method="rows.drop_datetimes", variant="all", cols="*", how="any") + t.create(method="rows.drop_datetimes", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_datetimes", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_datetimes", variant="multiple", cols=["Date Type", "last date seen", "timestamp"], how="all") + + df2 = df.cols.append( + {"objects_test": ['1980/04/10', True, None, float("inf"), "yes", "bytearray(12, 'utf-8')"]}) + + t.create(df=df2, method="rows.drop_objects", cols=["objects_test"], how="any") + t.create(method="rows.drop_objects", variant="all", cols="*", how="any") + t.create(method="rows.drop_objects", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_objects", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_objects", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + df2 = df.cols.append( + {"arrays_test": [[1, 2, 3, 4], [[1], [2, 3]], ["one", "two"], ["one", ["two", [float("-inf")]]], ["yes"], "bytearray(12, 'utf-8')"]}) + + t.create(df=df2, method="rows.drop_arrays", cols=["arrays_test"], how="any") + t.create(method="rows.drop_arrays", variant="all", cols="*", how="any") + t.create(method="rows.drop_arrays", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_arrays", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_arrays", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + df2 = df.cols.append( + {"phone_numbers_test": [5516528967, "55 8395 1284", "+52 55 3913 1941", "+1 (210) 589-6721", 12106920692, "5532592785"]}) + + t.create(df=df2, method="rows.drop_phone_numbers", cols=["phone_numbers_test"], how="any") + t.create(method="rows.drop_phone_numbers", variant="all", cols="*", how="any") + t.create(method="rows.drop_phone_numbers", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_phone_numbers", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_phone_numbers", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + df2 = df.cols.append( + {"social_security_numbers_test": [372847278, "551-83-1284", "525 93 1941", "230 89-6721", "121-069 2062", "371847288"]}) + + t.create(df=df2, method="rows.drop_social_security_numbers", cols=["social_security_numbers_test"], how="any") + t.create(method="rows.drop_social_security_numbers", variant="all", cols="*", how="any") + t.create(method="rows.drop_social_security_numbers", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_social_security_numbers", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_social_security_numbers", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + df2 = df.cols.append( + {"http_codes_test": ["http://github.com/hi-primus/optimus", "localhost:3000?help=true", "http://www.images.hi-example.com:54/images.php#id?help=1&freq=2", "hi-optimus.com", "http://www.computerhope.com/cgi-bin/search.cgi?q=example%20search&example=test", "http://www.google.com/search?q=this+is+a+test&client=safari&sxsrf=ALe&source=hp&ei=NL0-y4&iflsig=AINF&oq=this+is+a+test&gs_lcp=MZgBAKA&sclient=gws-wiz&ved=0ah&uact=5"]}) + + t.create(df=df2, method="rows.drop_http_codes", cols=["http_codes_test"], how="any") + t.create(method="rows.drop_http_codes", variant="all", cols="*", how="any") + t.create(method="rows.drop_http_codes", variant="numeric", cols=["height(ft)"], how="any") + t.create(method="rows.drop_http_codes", variant="string", cols=["names"], how="all") + t.create(method="rows.drop_http_codes", variant="multiple", cols=["NullType", "weight(t)", "japanese name"], how="all") + + t.create(method="rows.drop_by_expression", variant="all_expression", cols="*", where='df["rank"]>8', how="any") + t.create(method="rows.drop_by_expression", variant="all_colname", where="last position seen", how="all") + t.create(method="rows.drop_by_expression", variant="numeric_expression", where='df["height(ft)"]>=0', how="any") + t.create(method="rows.drop_by_expression", variant="numeric_colname", where="height(ft)", how="all") + t.create(method="rows.drop_by_expression", variant="string_expression", where='df["function"]=="Leader"', how="any") + t.create(method="rows.drop_by_expression", variant="string_colname", where="function", how="all") + t.create(method="rows.drop_by_expression", variant="multiple_expression", where='df["Cybertronian"]==False', how="any") + t.create(method="rows.drop_by_expression", variant="multiple_colname", where="NullType", how="all") + + t.run() + +create() \ No newline at end of file diff --git a/tests/test_created__rows.py b/tests/test_created__rows.py new file mode 100644 index 000000000..8e8345524 --- /dev/null +++ b/tests/test_created__rows.py @@ -0,0 +1,2541 @@ +import datetime +from optimus.tests.base import TestBase +from optimus.helpers.json import json_encoding +from optimus.helpers.functions import deep_sort, df_dicts_equal, results_equal + + +def Timestamp(t): + return datetime.datetime.strptime(t, "%Y-%m-%d %H:%M:%S") + + +nan = float("nan") +inf = float("inf") + + +class TestRowsPandas(TestBase): + config = {'engine': 'pandas'} + dict = {('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]} + maxDiff = None + + def test_rows_append_multiple_complete(self): + df = self.df + result = df.rows.append(dfs=[ id firstName lastName billingId product price birth dummyCol + (int64) (object) (object) (int64) (object) (int64) (object) (object) +--------- ----------- ----------- ----------- ---------- --------- ---------- ---------- + 1 Luis Alvarez$$%! 123 Cake 10 1980/07/07 never + 2 André Ampère 423 piza 8 1950/07/08 gonna +, + email_test ip_test +(object) (object) +--------------------- -------------- +an@example.com 192.0.2.1 +thisisatest@gmail.com 192.158.1.38 +somename@hotmail.com 192.168.136.52 +]) + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None, nan, nan, nan, nan, nan], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None], nan, nan, nan, nan, nan], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', nan, nan, nan, nan, nan], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station'), nan, nan, nan, nan, nan], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0, nan, nan, nan, nan, nan], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex'], nan, nan, nan, nan, nan], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10', nan, nan, nan, nan, nan], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None, nan, nan, nan, nan, nan], ('rank', 'float64'): [10.0, 7.0, 7.0, 8.0, 10.0, 8.0, nan, nan, nan, nan, nan], ('Cybertronian', 'object'): [True, True, True, True, True, False, nan, nan, nan, nan, nan], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00'), NaT, NaT, NaT, NaT, NaT], ('age', 'float64'): [5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, nan, nan, nan, nan, nan], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station', nan, nan, nan, nan, nan], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$', nan, nan, nan, nan, nan], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), NaT, NaT, NaT, NaT, NaT], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan, nan, nan, nan, nan, nan], ('id', 'float64'): [nan, nan, nan, nan, nan, nan, 1.0, 2.0, nan, nan, nan], ('firstName', 'object'): [nan, nan, nan, nan, nan, nan, 'Luis', 'André', nan, nan, nan], ('lastName', 'object'): [nan, nan, nan, nan, nan, nan, 'Alvarez$$%!', 'Ampère', nan, nan, nan], ('billingId', 'float64'): [nan, nan, nan, nan, nan, nan, 123.0, 423.0, nan, nan, nan], ('product', 'object'): [nan, nan, nan, nan, nan, nan, 'Cake', 'piza', nan, nan, nan], ('price', 'float64'): [nan, nan, nan, nan, nan, nan, 10.0, 8.0, nan, nan, nan], ('birth', 'object'): [nan, nan, nan, nan, nan, nan, '1980/07/07', '1950/07/08', nan, nan, nan], ('dummyCol', 'object'): [nan, nan, nan, nan, nan, nan, 'never', 'gonna', nan, nan, nan], ('email_test', 'object'): [nan, nan, nan, nan, nan, nan, nan, nan, 'an@example.com', 'thisisatest@gmail.com', 'somename@hotmail.com'], ('ip_test', 'object'): [nan, nan, nan, nan, nan, nan, nan, nan, '192.0.2.1', '192.158.1.38', '192.168.136.52']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_append_multiple_one_col(self): + df = self.df + result = df.rows.append(dfs=[ id firstName lastName billingId product price birth dummyCol + (int64) (object) (object) (int64) (object) (int64) (object) (object) +--------- ----------- ----------- ----------- ---------- --------- ---------- ---------- + 1 Luis Alvarez$$%! 123 Cake 10 1980/07/07 never + 2 André Ampère 423 piza 8 1950/07/08 gonna +, + email_test ip_test +(object) (object) +--------------------- -------------- +an@example.com 192.0.2.1 +thisisatest@gmail.com 192.158.1.38 +somename@hotmail.com 192.168.136.52 +], names_map={'Only': ['attributes', 'dummyCol', 'object_test']}) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_append_multiple_some_cols(self): + df = self.df + result = df.rows.append(dfs=[ id firstName lastName billingId product price birth dummyCol + (int64) (object) (object) (int64) (object) (int64) (object) (object) +--------- ----------- ----------- ----------- ---------- --------- ---------- ---------- + 1 Luis Alvarez$$%! 123 Cake 10 1980/07/07 never + 2 André Ampère 423 piza 8 1950/07/08 gonna +, + email_test ip_test +(object) (object) +--------------------- -------------- +an@example.com 192.0.2.1 +thisisatest@gmail.com 192.158.1.38 +somename@hotmail.com 192.168.136.52 +], names_map={'First': ['last position seen', 'product', 'ip_test'], + 'Second': ['date arrival', 'firstName', 'object_test'], + 'Third': ['names', 'lastName', 'email_test']}) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_append_single_complete(self): + df = self.df + result = df.rows.append(dfs=[ id firstName lastName billingId product price birth dummyCol + (int64) (object) (object) (int64) (object) (int64) (object) (object) +--------- ----------- ----------- ----------- ---------- --------- ---------- ---------- + 1 Luis Alvarez$$%! 123 Cake 10 1980/07/07 never + 2 André Ampère 423 piza 8 1950/07/08 gonna +]) + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None, nan, nan], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None], nan, nan], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', nan, nan], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station'), nan, nan], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0, nan, nan], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex'], nan, nan], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10', nan, nan], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None, nan, nan], ('rank', 'float64'): [10.0, 7.0, 7.0, 8.0, 10.0, 8.0, nan, nan], ('Cybertronian', 'object'): [True, True, True, True, True, False, nan, nan], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00'), NaT, NaT], ('age', 'float64'): [5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, nan, nan], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station', nan, nan], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$', nan, nan], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), NaT, NaT], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan, nan, nan], ('id', 'float64'): [nan, nan, nan, nan, nan, nan, 1.0, 2.0], ('firstName', 'object'): [nan, nan, nan, nan, nan, nan, 'Luis', 'André'], ('lastName', 'object'): [nan, nan, nan, nan, nan, nan, 'Alvarez$$%!', 'Ampère'], ('billingId', 'float64'): [nan, nan, nan, nan, nan, nan, 123.0, 423.0], ('product', 'object'): [nan, nan, nan, nan, nan, nan, 'Cake', 'piza'], ('price', 'float64'): [nan, nan, nan, nan, nan, nan, 10.0, 8.0], ('birth', 'object'): [nan, nan, nan, nan, nan, nan, '1980/07/07', '1950/07/08'], ('dummyCol', 'object'): [nan, nan, nan, nan, nan, nan, 'never', 'gonna']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_append_single_one_col(self): + df = self.df + result = df.rows.append(dfs=[ id firstName lastName billingId product price birth dummyCol + (int64) (object) (object) (int64) (object) (int64) (object) (object) +--------- ----------- ----------- ----------- ---------- --------- ---------- ---------- + 1 Luis Alvarez$$%! 123 Cake 10 1980/07/07 never + 2 André Ampère 423 piza 8 1950/07/08 gonna +], names_map={'Only': ['japanese name', 'billingId']}) + expected = self.create_dataframe(dict={('Only', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex'], 123, 423]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_append_single_some_cols(self): + df = self.df + result = df.rows.append(dfs=[ id firstName lastName billingId product price birth dummyCol + (int64) (object) (object) (int64) (object) (int64) (object) (object) +--------- ----------- ----------- ----------- ---------- --------- ---------- ---------- + 1 Luis Alvarez$$%! 123 Cake 10 1980/07/07 never + 2 André Ampère 423 piza 8 1950/07/08 gonna +], names_map={'First': ['function', 'price'], + 'Second': ['weight(t)', 'id'], + 'Third': ['Cybertronian', 'birth']}) + expected = self.create_dataframe(dict={('First', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station', 10, 8], ('Second', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan, 1.0, 2.0], ('Third', 'object'): [True, True, True, True, True, False, '1980/07/07', '1950/07/08']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_approx_count(self): + df = self.df + result = df.rows.approx_count() + expected = 6 + self.assertTrue(results_equal(result, expected, decimal=5, assertion=True)) + + def test_rows_array(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('array_test', 'object'): [[1, 2, 3, 4], [[1], [2, 3]], ['one', 'two'], ['one', ['two', [-inf]]], ['yes'], "bytearray(12, 'utf-8')"]}, force_data_types=True) + result = df.rows.array(cols=['array_test'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): [], ('array_test', 'object'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_array_all(self): + df = self.df + result = df.rows.array(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_array_multiple(self): + df = self.df + result = df.rows.array(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_array_numeric(self): + df = self.df + result = df.rows.array(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_array_string(self): + df = self.df + result = df.rows.array(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_between_all(self): + df = self.df + result = df.rows.between(cols='*', lower_bound='-inf', upper_bound='inf', equal=True, drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_between_index_all(self): + df = self.df + result = df.rows.between_index(cols='*', lower_bound=0, upper_bound=1) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_between_index_multiple(self): + df = self.df + result = df.rows.between_index(cols=['rank', 'last date seen', 'Cybertronian'], lower_bound=2, upper_bound=5) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_between_index_single(self): + df = self.df + result = df.rows.between_index(cols=['names'], lower_bound=4, upper_bound=4) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_between_multiple(self): + df = self.df + result = df.rows.between(cols=['age', 'NullType', 'weight(t)'], bounds=[['-inf', -10], [0, 1.9999], [300, 5000000]], equal=True, drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_between_numeric(self): + df = self.df + result = df.rows.between(cols=['height(ft)'], bounds=[[26, -28]], equal=False, drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[5.334, 2000.0], [3.9624, 1800.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'First Lieutenant')], ('height(ft)', 'float64'): [17.0, 13.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Meister']], ('last date seen', 'object'): ['2015/08/10', '2013/06/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '33.670666,-117.841553'], ('rank', 'int64'): [7, 8], ('Cybertronian', 'bool'): [True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2013-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Espionage', 'First Lieutenant'], ('names', 'object'): ['bumbl#ebéé ', 'Jazz'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 1.8]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_between_string(self): + df = self.df + result = df.rows.between(cols=['names'], upper_bound='-inf', lower_bound=0, equal=False, drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_boolean(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('boolean_test', 'object'): ['True', 'False', True, False, 1, 0]}, force_data_types=True) + result = df.rows.boolean(cols=['boolean_test'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): [], ('boolean_test', 'object'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_boolean_all(self): + df = self.df + result = df.rows.boolean(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_boolean_multiple(self): + df = self.df + result = df.rows.boolean(cols=['NullType', 'weight(t)', 'Cybertronian'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_boolean_numeric(self): + df = self.df + result = df.rows.boolean(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_boolean_string(self): + df = self.df + result = df.rows.boolean(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_contains_all(self): + df = self.df + result = df.rows.contains(cols='*', value='a', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_contains_multiple(self): + df = self.df + result = df.rows.contains(cols=['NullType', 'weight(t)', 'Cybertronian'], value='T', drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_contains_numeric(self): + df = self.df + result = df.rows.contains(cols=['height(ft)'], value='0', drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 7, 7, 8, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_contains_string(self): + df = self.df + result = df.rows.contains(cols=['function'], value='Le', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_count(self): + df = self.df + result = df.rows.count() + expected = 6 + self.assertTrue(results_equal(result, expected, decimal=5, assertion=True)) + + def test_rows_credit_card_number(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('credit_card_number_test', 'object'): ['2345 6362 6362 8632', 5692857295730750, '31028482204828450', '99 77 80 14 53 73 83 53', '8 5 0 0 1 5 8 1 5 8 3 7 0 0 0 1', 10]}, force_data_types=True) + result = df.rows.credit_card_number(cols=['credit_card_number_test'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): [], ('credit_card_number_test', 'object'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_credit_card_number_all(self): + df = self.df + result = df.rows.credit_card_number(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_credit_card_number_multiple(self): + df = self.df + result = df.rows.credit_card_number(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_credit_card_number_numeric(self): + df = self.df + result = df.rows.credit_card_number(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_credit_card_number_string(self): + df = self.df + result = df.rows.credit_card_number(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_datetime(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('datetime_test', 'object'): ['1980/04/10', '5.0', datetime.datetime(2016, 9, 10, 0, 0), datetime.datetime(2014, 6, 24, 0, 0), '2013/06/10', datetime.datetime(2011, 4, 10, 0, 0)]}, force_data_types=True) + result = df.rows.datetime(cols=['datetime_test'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): [], ('datetime_test', 'object'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_datetime_all(self): + df = self.df + result = df.rows.datetime(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_datetime_multiple(self): + df = self.df + result = df.rows.datetime(cols=['Date Type', 'last date seen', 'timestamp'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_datetime_numeric(self): + df = self.df + result = df.rows.datetime(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_datetime_string(self): + df = self.df + result = df.rows.datetime(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_arrays(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('arrays_test', 'object'): [[1, 2, 3, 4], [[1], [2, 3]], ['one', 'two'], ['one', ['two', [-inf]]], ['yes'], "bytearray(12, 'utf-8')"]}, force_data_types=True) + result = df.rows.drop_arrays(cols=['arrays_test'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('arrays_test', 'object'): [[1, 2, 3, 4], [[1], [2, 3]], ['one', 'two'], ['one', ['two', [-inf]]], ['yes'], "bytearray(12, 'utf-8')"]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_arrays_all(self): + df = self.df + result = df.rows.drop_arrays(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_arrays_multiple(self): + df = self.df + result = df.rows.drop_arrays(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_arrays_numeric(self): + df = self.df + result = df.rows.drop_arrays(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_arrays_string(self): + df = self.df + result = df.rows.drop_arrays(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_between_all(self): + df = self.df + result = df.rows.drop_between(cols='*', lower_bound='-inf', upper_bound='inf', equal=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_between_multiple(self): + df = self.df + result = df.rows.drop_between(cols=['age', 'NullType', 'weight(t)'], bounds=[['-inf', -10], [0, 1.9999], [300, 5000000]], equal=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_between_numeric(self): + df = self.df + result = df.rows.drop_between(cols=['height(ft)'], bounds=[[26, -28]], equal=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [7.9248, 4000.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Security'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 26.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Roadbuster'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2014/07/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '37.789563,-122.400356', None, None], ('rank', 'int64'): [10, 7, 10, 8], ('Cybertronian', 'bool'): [True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Security', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'ironhide&', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 4.0, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_between_string(self): + df = self.df + result = df.rows.drop_between(cols=['names'], upper_bound='-inf', lower_bound=0, equal=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_booleans(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('booleans_test', 'object'): ['True', 'False', True, False, 1, 0]}, force_data_types=True) + result = df.rows.drop_booleans(cols=['booleans_test'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('booleans_test', 'object'): ['True', 'False', True, False, 1, 0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_booleans_all(self): + df = self.df + result = df.rows.drop_booleans(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_booleans_multiple(self): + df = self.df + result = df.rows.drop_booleans(cols=['NullType', 'weight(t)', 'Cybertronian'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_booleans_numeric(self): + df = self.df + result = df.rows.drop_booleans(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_booleans_string(self): + df = self.df + result = df.rows.drop_booleans(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_by_expression_all_colname(self): + df = self.df + result = df.rows.drop_by_expression(where='last position seen', how='all') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_by_expression_all_expression(self): + df = self.df + result = df.rows.drop_by_expression(cols='*', where='df["rank"]>8', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [7, 7, 8, 8], ('Cybertronian', 'bool'): [True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_by_expression_multiple_colname(self): + df = self.df + result = df.rows.drop_by_expression(where='NullType', how='all') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_by_expression_multiple_expression(self): + df = self.df + result = df.rows.drop_by_expression(where='df["Cybertronian"]==False', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 7, 7, 8, 10], ('Cybertronian', 'bool'): [True, True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_by_expression_numeric_colname(self): + df = self.df + result = df.rows.drop_by_expression(where='height(ft)', how='all') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_by_expression_numeric_expression(self): + df = self.df + result = df.rows.drop_by_expression(where='df["height(ft)"]>=0', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[8.5344, 4300.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'None')], ('height(ft)', 'float64'): [-28.0, nan], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Megatron']], ('last date seen', 'object'): ['2016/09/10', '2012/05/10'], ('last position seen', 'object'): ['19.442735,-99.201111', None], ('rank', 'int64'): [10, 10], ('Cybertronian', 'bool'): [True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Leader', 'None'], ('names', 'object'): ['Optimus', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_by_expression_string_colname(self): + df = self.df + result = df.rows.drop_by_expression(where='function', how='all') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_by_expression_string_expression(self): + df = self.df + result = df.rows.drop_by_expression(where='df["function"]=="Leader"', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_col_name(self): + df = self.df + result = df.rows.drop(where='Cybertronian') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[91.44, None]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Battle Station')], ('height(ft)', 'float64'): [300.0], ('japanese name', 'object'): [['Metroflex']], ('last date seen', 'object'): ['2011/04/10'], ('last position seen', 'object'): [None], ('rank', 'int64'): [8], ('Cybertronian', 'bool'): [False], ('Date Type', 'datetime64[ns]'): [Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['Battle Station'], ('names', 'object'): ['Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_contains_all(self): + df = self.df + result = df.rows.drop_contains(cols='*', value='a', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_contains_multiple(self): + df = self.df + result = df.rows.drop_contains(cols=['NullType', 'weight(t)', 'Cybertronian'], value='T', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_contains_numeric(self): + df = self.df + result = df.rows.drop_contains(cols=['height(ft)'], value='0', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[None, 5700.0]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'None')], ('height(ft)', 'float64'): [nan], ('japanese name', 'object'): [['Megatron']], ('last date seen', 'object'): ['2012/05/10'], ('last position seen', 'object'): [None], ('rank', 'int64'): [10], ('Cybertronian', 'bool'): [True], ('Date Type', 'datetime64[ns]'): [Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['None'], ('names', 'object'): ['Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_contains_string(self): + df = self.df + result = df.rows.drop_contains(cols=['function'], value='Le', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_credit_card_numbers(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('credit_card_numbers_test', 'object'): ['2345 6362 6362 8632', 5692857295730750, '31028482204828450', '99 77 80 14 53 73 83 53', '8 5 0 0 1 5 8 1 5 8 3 7 0 0 0 1', 10]}, force_data_types=True) + result = df.rows.drop_credit_card_numbers(cols=['credit_card_numbers_test'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('credit_card_numbers_test', 'object'): ['2345 6362 6362 8632', 5692857295730750, '31028482204828450', '99 77 80 14 53 73 83 53', '8 5 0 0 1 5 8 1 5 8 3 7 0 0 0 1', 10]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_credit_card_numbers_all(self): + df = self.df + result = df.rows.drop_credit_card_numbers(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_credit_card_numbers_multiple(self): + df = self.df + result = df.rows.drop_credit_card_numbers(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_credit_card_numbers_numeric(self): + df = self.df + result = df.rows.drop_credit_card_numbers(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_credit_card_numbers_string(self): + df = self.df + result = df.rows.drop_credit_card_numbers(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_datetimes(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('datetimes_test', 'object'): ['1980/04/10', '5.0', datetime.datetime(2016, 9, 10, 0, 0), datetime.datetime(2014, 6, 24, 0, 0), '2013/06/10', datetime.datetime(2011, 4, 10, 0, 0)]}, force_data_types=True) + result = df.rows.drop_datetimes(cols=['datetimes_test'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('datetimes_test', 'object'): ['1980/04/10', '5.0', datetime.datetime(2016, 9, 10, 0, 0), datetime.datetime(2014, 6, 24, 0, 0), '2013/06/10', datetime.datetime(2011, 4, 10, 0, 0)]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_datetimes_all(self): + df = self.df + result = df.rows.drop_datetimes(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_datetimes_multiple(self): + df = self.df + result = df.rows.drop_datetimes(cols=['Date Type', 'last date seen', 'timestamp'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_datetimes_numeric(self): + df = self.df + result = df.rows.drop_datetimes(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_datetimes_string(self): + df = self.df + result = df.rows.drop_datetimes(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_duplicated_all(self): + df = self.df + result = df.rows.drop_duplicated(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_duplicated_all_first(self): + df = self.df + result = df.rows.drop_duplicated(cols='*', keep='first', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_duplicated_all_last(self): + df = self.df + result = df.rows.drop_duplicated(cols='*', keep='last', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_duplicated_multiple(self): + df = self.df + result = df.rows.drop_duplicated(cols=['NullType', 'timestamp', 'Cybertronian'], keep='first', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[8.5344, 4300.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', None], ('rank', 'int64'): [10, 8], ('Cybertronian', 'bool'): [True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Leader', 'Battle Station'], ('names', 'object'): ['Optimus', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_duplicated_multiple_first(self): + df = self.df + result = df.rows.drop_duplicated(cols=['NullType', 'timestamp', 'Cybertronian'], keep='first', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[8.5344, 4300.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', None], ('rank', 'int64'): [10, 8], ('Cybertronian', 'bool'): [True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Leader', 'Battle Station'], ('names', 'object'): ['Optimus', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_duplicated_multiple_last(self): + df = self.df + result = df.rows.drop_duplicated(cols=['NullType', 'timestamp', 'Cybertronian'], keep='first', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[8.5344, 4300.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', None], ('rank', 'int64'): [10, 8], ('Cybertronian', 'bool'): [True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Leader', 'Battle Station'], ('names', 'object'): ['Optimus', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_duplicated_numeric(self): + df = self.df + result = df.rows.drop_duplicated(cols=['rank'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [3.9624, 1800.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'First Lieutenant')], ('height(ft)', 'float64'): [-28.0, 17.0, 13.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Meister']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2013/06/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '33.670666,-117.841553'], ('rank', 'int64'): [10, 7, 8], ('Cybertronian', 'bool'): [True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2013-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'First Lieutenant'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'Jazz'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 1.8]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_duplicated_numeric_first(self): + df = self.df + result = df.rows.drop_duplicated(cols=['rank'], keep='first', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [3.9624, 1800.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'First Lieutenant')], ('height(ft)', 'float64'): [-28.0, 17.0, 13.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Meister']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2013/06/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '33.670666,-117.841553'], ('rank', 'int64'): [10, 7, 8], ('Cybertronian', 'bool'): [True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2013-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'First Lieutenant'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'Jazz'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 1.8]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_duplicated_numeric_last(self): + df = self.df + result = df.rows.drop_duplicated(cols=['rank'], keep='last', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[7.9248, 4000.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Security'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [26.0, nan, 300.0], ('japanese name', 'object'): [['Roadbuster'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2014/07/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['37.789563,-122.400356', None, None], ('rank', 'int64'): [7, 10, 8], ('Cybertronian', 'bool'): [True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Security', 'None', 'Battle Station'], ('names', 'object'): ['ironhide&', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.0, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_duplicated_string(self): + df = self.df + result = df.rows.drop_duplicated(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_duplicated_string_first(self): + df = self.df + result = df.rows.drop_duplicated(cols=['names'], keep='first', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_duplicated_string_last(self): + df = self.df + result = df.rows.drop_duplicated(cols=['names'], keep='last', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_emails(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('emails_test', 'object'): ['an@example.com', 'thisisatest@gmail.com', 'somename@hotmail.com', 'an@outlook.com', 'anexample@mail.com', 'example@yahoo.com']}, force_data_types=True) + result = df.rows.drop_emails(cols=['emails_test'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): [], ('emails_test', 'object'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_emails_all(self): + df = self.df + result = df.rows.drop_emails(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_emails_multiple(self): + df = self.df + result = df.rows.drop_emails(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_emails_numeric(self): + df = self.df + result = df.rows.drop_emails(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_emails_string(self): + df = self.df + result = df.rows.drop_emails(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_empty_all(self): + df = self.df + result = df.rows.drop_empty(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_empty_multiple(self): + df = self.df + result = df.rows.drop_empty(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_empty_numeric(self): + df = self.df + result = df.rows.drop_empty(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_empty_string(self): + df = self.df + result = df.rows.drop_empty(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_ends_with_all(self): + df = self.df + result = df.rows.drop_ends_with(cols='*', value=']', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_ends_with_multiple(self): + df = self.df + result = df.rows.drop_ends_with(cols=['NullType', 'weight(t)', 'Cybertronian'], value='one', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_ends_with_numeric(self): + df = self.df + result = df.rows.drop_ends_with(cols=['height(ft)'], value=0, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_ends_with_string(self): + df = self.df + result = df.rows.drop_ends_with(cols=['function'], value='e', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [7.9248, 4000.0], [3.9624, 1800.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 26.0, 13.0, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Roadbuster'], ['Meister'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2014/07/10', '2013/06/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 7, 8, 8], ('Cybertronian', 'bool'): [True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Security', 'First Lieutenant', 'Battle Station'], ('names', 'object'): ['Optimus', 'ironhide&', 'Jazz', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 4.0, 1.8, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_equal_all(self): + df = self.df + result = df.rows.drop_equal(cols='*', value=10, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [7, 7, 8, 8], ('Cybertronian', 'bool'): [True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_equal_multiple(self): + df = self.df + result = df.rows.drop_equal(cols=['NullType', 'weight(t)', 'Cybertronian'], value=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_equal_numeric(self): + df = self.df + result = df.rows.drop_equal(cols=['height(ft)'], value=300, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 7, 7, 8, 10], ('Cybertronian', 'bool'): [True, True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_equal_string(self): + df = self.df + result = df.rows.drop_equal(cols=['function'], value='Leader', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_expression(self): + df = self.df + result = df.rows.drop(where= height(ft) + (bool) +------------ + 0 + 1 + 1 + 0 + 0 + 1 +) + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [3.9624, 1800.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'First Lieutenant'), bytearray(b'None')], ('height(ft)', 'float64'): [-28.0, 13.0, nan], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Meister'], ['Megatron']], ('last date seen', 'object'): ['2016/09/10', '2013/06/10', '2012/05/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 8, 10], ('Cybertronian', 'bool'): [True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'First Lieutenant', 'None'], ('names', 'object'): ['Optimus', 'Jazz', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 1.8, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_find_all(self): + df = self.df + result = df.rows.drop_find(cols='*', value='None', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_find_multiple(self): + df = self.df + result = df.rows.drop_find(cols=['NullType', 'weight(t)', 'Cybertronian'], value=1, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_find_numeric(self): + df = self.df + result = df.rows.drop_find(cols=['height(ft)'], value=13, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', None, None], ('rank', 'int64'): [10, 7, 7, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_find_string(self): + df = self.df + result = df.rows.drop_find(cols=['function'], value='Leader', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_float_all(self): + df = self.df + result = df.rows.drop_float(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_float_multiple(self): + df = self.df + result = df.rows.drop_float(cols=['rank', 'last date seen', 'Cybertronian'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_float_numeric(self): + df = self.df + result = df.rows.drop_float(cols=['weight(t)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_float_string(self): + df = self.df + result = df.rows.drop_float(cols=['function'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_genders(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('genders_test', 'object'): ['male', 'female', 'Male', '5.0', 'MALE', 'FEMALE']}, force_data_types=True) + result = df.rows.drop_genders(cols=['genders_test'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.0, 1.8, 5.7, nan], ('genders_test', 'object'): ['Male', '5.0', 'MALE', 'FEMALE']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_genders_all(self): + df = self.df + result = df.rows.drop_genders(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_genders_multiple(self): + df = self.df + result = df.rows.drop_genders(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_genders_numeric(self): + df = self.df + result = df.rows.drop_genders(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_genders_string(self): + df = self.df + result = df.rows.drop_genders(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_greater_than_all(self): + df = self.df + result = df.rows.drop_greater_than(cols='*', value=10, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_greater_than_equal_all(self): + df = self.df + result = df.rows.drop_greater_than_equal(cols='*', value=10, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_greater_than_equal_multiple(self): + df = self.df + result = df.rows.drop_greater_than_equal(cols=['age', 'NullType', 'weight(t)'], value='-inf', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_greater_than_equal_numeric(self): + df = self.df + result = df.rows.drop_greater_than_equal(cols=['height(ft)'], value=0.31, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[8.5344, 4300.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'None')], ('height(ft)', 'float64'): [-28.0, nan], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Megatron']], ('last date seen', 'object'): ['2016/09/10', '2012/05/10'], ('last position seen', 'object'): ['19.442735,-99.201111', None], ('rank', 'int64'): [10, 10], ('Cybertronian', 'bool'): [True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Leader', 'None'], ('names', 'object'): ['Optimus', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_greater_than_equal_string(self): + df = self.df + result = df.rows.drop_greater_than_equal(cols=['names'], value=0, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_greater_than_multiple(self): + df = self.df + result = df.rows.drop_greater_than(cols=['age', 'NullType', 'weight(t)'], value='-inf', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_greater_than_numeric(self): + df = self.df + result = df.rows.drop_greater_than(cols=['height(ft)'], value=-0.31, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[8.5344, 4300.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'None')], ('height(ft)', 'float64'): [-28.0, nan], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Megatron']], ('last date seen', 'object'): ['2016/09/10', '2012/05/10'], ('last position seen', 'object'): ['19.442735,-99.201111', None], ('rank', 'int64'): [10, 10], ('Cybertronian', 'bool'): [True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Leader', 'None'], ('names', 'object'): ['Optimus', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_greater_than_string(self): + df = self.df + result = df.rows.drop_greater_than(cols=['names'], value=0, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_http_codes(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('http_codes_test', 'object'): ['http://github.com/hi-primus/optimus', 'localhost:3000?help=true', 'http://www.images.hi-example.com:54/images.php#id?help=1&freq=2', 'hi-optimus.com', 'http://www.computerhope.com/cgi-bin/search.cgi?q=example%20search&example=test', 'http://www.google.com/search?q=this+is+a+test&client=safari&sxsrf=ALe&source=hp&ei=NL0-y4&iflsig=AINF&oq=this+is+a+test&gs_lcp=MZgBAKA&sclient=gws-wiz&ved=0ah&uact=5']}, force_data_types=True) + result = df.rows.drop_http_codes(cols=['http_codes_test'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('http_codes_test', 'object'): ['http://github.com/hi-primus/optimus', 'localhost:3000?help=true', 'http://www.images.hi-example.com:54/images.php#id?help=1&freq=2', 'hi-optimus.com', 'http://www.computerhope.com/cgi-bin/search.cgi?q=example%20search&example=test', 'http://www.google.com/search?q=this+is+a+test&client=safari&sxsrf=ALe&source=hp&ei=NL0-y4&iflsig=AINF&oq=this+is+a+test&gs_lcp=MZgBAKA&sclient=gws-wiz&ved=0ah&uact=5']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_http_codes_all(self): + df = self.df + result = df.rows.drop_http_codes(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_http_codes_multiple(self): + df = self.df + result = df.rows.drop_http_codes(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_http_codes_numeric(self): + df = self.df + result = df.rows.drop_http_codes(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_http_codes_string(self): + df = self.df + result = df.rows.drop_http_codes(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_int_all(self): + df = self.df + result = df.rows.drop_int(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_int_multiple(self): + df = self.df + result = df.rows.drop_int(cols=['rank', 'last date seen', 'Cybertronian'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_int_numeric(self): + df = self.df + result = df.rows.drop_int(cols=['weight(t)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_int_string(self): + df = self.df + result = df.rows.drop_int(cols=['function'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_ips(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('ips_test', 'object'): ['192.0.2.1', '192.158.1.38', '192.168.136.52', '172.16.92.107', '10.63.215.5', '10.0.5.0']}, force_data_types=True) + result = df.rows.drop_ips(cols=['ips_test'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): [], ('ips_test', 'object'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_ips_all(self): + df = self.df + result = df.rows.drop_ips(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_ips_multiple(self): + df = self.df + result = df.rows.drop_ips(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_ips_numeric(self): + df = self.df + result = df.rows.drop_ips(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_ips_string(self): + df = self.df + result = df.rows.drop_ips(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_less_than_all(self): + df = self.df + result = df.rows.drop_less_than(cols='*', value=10, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_less_than_equal_all(self): + df = self.df + result = df.rows.drop_less_than_equal(cols='*', value=10, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_less_than_equal_multiple(self): + df = self.df + result = df.rows.drop_less_than_equal(cols=['age', 'NullType', 'weight(t)'], value='inf', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_less_than_equal_numeric(self): + df = self.df + result = df.rows.drop_less_than_equal(cols=['height(ft)'], value=0.31, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_less_than_equal_string(self): + df = self.df + result = df.rows.drop_less_than_equal(cols=['names'], value=0, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_less_than_multiple(self): + df = self.df + result = df.rows.drop_less_than(cols=['age', 'NullType', 'weight(t)'], value='inf', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_less_than_numeric(self): + df = self.df + result = df.rows.drop_less_than(cols=['height(ft)'], value=0.31, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_less_than_string(self): + df = self.df + result = df.rows.drop_less_than(cols=['names'], value=0, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_mask(self): + df = self.df + result = df.rows.drop(where= last position seen + (bool) +-------------------- + 0 + 0 + 0 + 0 + 1 + 1 +) + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553'], ('rank', 'int64'): [10, 7, 7, 8], ('Cybertronian', 'bool'): [True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_missings_all(self): + df = self.df + result = df.rows.drop_missings(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_missings_multiple(self): + df = self.df + result = df.rows.drop_missings(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_missings_numeric(self): + df = self.df + result = df.rows.drop_missings(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 7, 7, 8, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_missings_string(self): + df = self.df + result = df.rows.drop_missings(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_nan_all(self): + df = self.df + result = df.rows.drop_nan(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553'], ('rank', 'int64'): [10, 7, 7, 8], ('Cybertronian', 'bool'): [True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_nan_multiple(self): + df = self.df + result = df.rows.drop_nan(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_nan_numeric(self): + df = self.df + result = df.rows.drop_nan(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 7, 7, 8, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_nan_string(self): + df = self.df + result = df.rows.drop_nan(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_none_all(self): + df = self.df + result = df.rows.drop_none(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_none_multiple(self): + df = self.df + result = df.rows.drop_none(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_none_numeric(self): + df = self.df + result = df.rows.drop_none(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_none_string(self): + df = self.df + result = df.rows.drop_none(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_not_equal_all(self): + df = self.df + result = df.rows.drop_not_equal(cols='*', value=10, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_not_equal_multiple(self): + df = self.df + result = df.rows.drop_not_equal(cols=['NullType', 'weight(t)', 'Cybertronian'], value=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 7, 7, 8, 10], ('Cybertronian', 'bool'): [True, True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_not_equal_numeric(self): + df = self.df + result = df.rows.drop_not_equal(cols=['height(ft)'], value=300, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[91.44, None]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Battle Station')], ('height(ft)', 'float64'): [300.0], ('japanese name', 'object'): [['Metroflex']], ('last date seen', 'object'): ['2011/04/10'], ('last position seen', 'object'): [None], ('rank', 'int64'): [8], ('Cybertronian', 'bool'): [False], ('Date Type', 'datetime64[ns]'): [Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['Battle Station'], ('names', 'object'): ['Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_not_equal_string(self): + df = self.df + result = df.rows.drop_not_equal(cols=['function'], value='Leader', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[8.5344, 4300.0]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader')], ('height(ft)', 'float64'): [-28.0], ('japanese name', 'object'): [['Inochi', 'Convoy']], ('last date seen', 'object'): ['2016/09/10'], ('last position seen', 'object'): ['19.442735,-99.201111'], ('rank', 'int64'): [10], ('Cybertronian', 'bool'): [True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['Leader'], ('names', 'object'): ['Optimus'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_nulls_all(self): + df = self.df + result = df.rows.drop_nulls(cols='*', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_nulls_multiple(self): + df = self.df + result = df.rows.drop_nulls(cols=['NullType', 'weight(t)', 'japanese name'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_nulls_numeric(self): + df = self.df + result = df.rows.drop_nulls(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 7, 7, 8, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_nulls_string(self): + df = self.df + result = df.rows.drop_nulls(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_numeric_all(self): + df = self.df + result = df.rows.drop_numeric(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_numeric_multiple(self): + df = self.df + result = df.rows.drop_numeric(cols=['rank', 'last date seen', 'Cybertronian'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_numeric_numeric(self): + df = self.df + result = df.rows.drop_numeric(cols=['weight(t)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_numeric_string(self): + df = self.df + result = df.rows.drop_numeric(cols=['function'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_objects(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('objects_test', 'object'): ['1980/04/10', True, None, inf, 'yes', "bytearray(12, 'utf-8')"]}, force_data_types=True) + result = df.rows.drop_objects(cols=['objects_test'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): [], ('objects_test', 'object'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_objects_all(self): + df = self.df + result = df.rows.drop_objects(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_objects_multiple(self): + df = self.df + result = df.rows.drop_objects(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_objects_numeric(self): + df = self.df + result = df.rows.drop_objects(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_objects_string(self): + df = self.df + result = df.rows.drop_objects(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_pattern_all(self): + df = self.df + result = df.rows.drop_pattern(cols='*', pattern='**cc**', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_pattern_multiple(self): + df = self.df + result = df.rows.drop_pattern(cols=['NullType', 'weight(t)', 'Cybertronian'], pattern='****', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_pattern_numeric(self): + df = self.df + result = df.rows.drop_pattern(cols=['height(ft)'], pattern='##!#', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_pattern_string(self): + df = self.df + result = df.rows.drop_pattern(cols=['function'], pattern='Ullclc', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_phone_numbers(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('phone_numbers_test', 'object'): [5516528967, '55 8395 1284', '+52 55 3913 1941', '+1 (210) 589-6721', 12106920692, '5532592785']}, force_data_types=True) + result = df.rows.drop_phone_numbers(cols=['phone_numbers_test'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553'], ('rank', 'int64'): [7, 7, 8], ('Cybertronian', 'bool'): [True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8], ('phone_numbers_test', 'object'): ['55 8395 1284', '+52 55 3913 1941', '+1 (210) 589-6721']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_phone_numbers_all(self): + df = self.df + result = df.rows.drop_phone_numbers(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_phone_numbers_multiple(self): + df = self.df + result = df.rows.drop_phone_numbers(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_phone_numbers_numeric(self): + df = self.df + result = df.rows.drop_phone_numbers(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_phone_numbers_string(self): + df = self.df + result = df.rows.drop_phone_numbers(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_social_security_numbers(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('social_security_numbers_test', 'object'): [372847278, '551-83-1284', '525 93 1941', '230 89-6721', '121-069 2062', '371847288']}, force_data_types=True) + result = df.rows.drop_social_security_numbers(cols=['social_security_numbers_test'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 4.0, 1.8, 5.7, nan], ('social_security_numbers_test', 'object'): [372847278, '525 93 1941', '230 89-6721', '121-069 2062', '371847288']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_social_security_numbers_all(self): + df = self.df + result = df.rows.drop_social_security_numbers(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_social_security_numbers_multiple(self): + df = self.df + result = df.rows.drop_social_security_numbers(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_social_security_numbers_numeric(self): + df = self.df + result = df.rows.drop_social_security_numbers(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_social_security_numbers_string(self): + df = self.df + result = df.rows.drop_social_security_numbers(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_starts_with_all(self): + df = self.df + result = df.rows.drop_starts_with(cols='*', value='N', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_starts_with_multiple(self): + df = self.df + result = df.rows.drop_starts_with(cols=['NullType', 'weight(t)', 'Cybertronian'], value=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_starts_with_numeric(self): + df = self.df + result = df.rows.drop_starts_with(cols=['height(ft)'], value=1, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_starts_with_string(self): + df = self.df + result = df.rows.drop_starts_with(cols=['function'], value='Lead', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_str_all(self): + df = self.df + result = df.rows.drop_str(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_str_multiple(self): + df = self.df + result = df.rows.drop_str(cols=['rank', 'last date seen', 'Cybertronian'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_str_numeric(self): + df = self.df + result = df.rows.drop_str(cols=['weight(t)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_str_string(self): + df = self.df + result = df.rows.drop_str(cols=['function'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_uniques_all(self): + df = self.df + result = df.rows.drop_uniques(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_uniques_all_first(self): + df = self.df + result = df.rows.drop_uniques(cols='*', keep='first', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_uniques_all_last(self): + df = self.df + result = df.rows.drop_uniques(cols='*', keep='last', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_uniques_multiple(self): + df = self.df + result = df.rows.drop_uniques(cols=['NullType', 'timestamp', 'Cybertronian'], keep='first', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [7, 7, 8, 10], ('Cybertronian', 'bool'): [True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_uniques_multiple_first(self): + df = self.df + result = df.rows.drop_uniques(cols=['NullType', 'timestamp', 'Cybertronian'], keep='first', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [7, 7, 8, 10], ('Cybertronian', 'bool'): [True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_uniques_multiple_last(self): + df = self.df + result = df.rows.drop_uniques(cols=['NullType', 'timestamp', 'Cybertronian'], keep='first', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [7, 7, 8, 10], ('Cybertronian', 'bool'): [True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_uniques_numeric(self): + df = self.df + result = df.rows.drop_uniques(cols=['rank'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[7.9248, 4000.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Security'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [26.0, nan, 300.0], ('japanese name', 'object'): [['Roadbuster'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2014/07/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['37.789563,-122.400356', None, None], ('rank', 'int64'): [7, 10, 8], ('Cybertronian', 'bool'): [True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Security', 'None', 'Battle Station'], ('names', 'object'): ['ironhide&', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.0, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_uniques_numeric_first(self): + df = self.df + result = df.rows.drop_uniques(cols=['rank'], keep='first', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[7.9248, 4000.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Security'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [26.0, nan, 300.0], ('japanese name', 'object'): [['Roadbuster'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2014/07/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['37.789563,-122.400356', None, None], ('rank', 'int64'): [7, 10, 8], ('Cybertronian', 'bool'): [True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Security', 'None', 'Battle Station'], ('names', 'object'): ['ironhide&', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.0, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_uniques_numeric_last(self): + df = self.df + result = df.rows.drop_uniques(cols=['rank'], keep='last', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [3.9624, 1800.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'First Lieutenant')], ('height(ft)', 'float64'): [-28.0, 17.0, 13.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Meister']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2013/06/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '33.670666,-117.841553'], ('rank', 'int64'): [10, 7, 8], ('Cybertronian', 'bool'): [True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2013-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'First Lieutenant'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'Jazz'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 1.8]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_uniques_string(self): + df = self.df + result = df.rows.drop_uniques(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_uniques_string_first(self): + df = self.df + result = df.rows.drop_uniques(cols=['names'], keep='first', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_uniques_string_last(self): + df = self.df + result = df.rows.drop_uniques(cols=['names'], keep='last', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_urls(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('urls_test', 'object'): ['https://github.com/hi-primus/optimus', 'localhost:3000?help=true', 'http://www.images.hi-example.com:54/images.php#id?help=1&freq=2', 'hi-optimus.com', 'https://www.computerhope.com/cgi-bin/search.cgi?q=example%20search&example=test', 'https://www.google.com/search?q=this+is+a+test&client=safari&sxsrf=ALe&source=hp&ei=NL0-y4&iflsig=AINF&oq=this+is+a+test&gs_lcp=MZgBAKA&sclient=gws-wiz&ved=0ah&uact=5']}, force_data_types=True) + result = df.rows.drop_urls(cols=['urls_test'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[5.334, 2000.0], [3.9624, 1800.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'First Lieutenant')], ('height(ft)', 'float64'): [17.0, 13.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Meister']], ('last date seen', 'object'): ['2015/08/10', '2013/06/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '33.670666,-117.841553'], ('rank', 'int64'): [7, 8], ('Cybertronian', 'bool'): [True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2013-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Espionage', 'First Lieutenant'], ('names', 'object'): ['bumbl#ebéé ', 'Jazz'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 1.8], ('urls_test', 'object'): ['localhost:3000?help=true', 'hi-optimus.com']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_urls_all(self): + df = self.df + result = df.rows.drop_urls(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_urls_multiple(self): + df = self.df + result = df.rows.drop_urls(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_urls_numeric(self): + df = self.df + result = df.rows.drop_urls(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_urls_string(self): + df = self.df + result = df.rows.drop_urls(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_value_in_all(self): + df = self.df + result = df.rows.drop_value_in(cols='*', values=[10, True, None, 'Jazz'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_value_in_multiple(self): + df = self.df + result = df.rows.drop_value_in(cols=['NullType', 'weight(t)', 'Cybertronian'], values=[False, None, 4], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_value_in_numeric(self): + df = self.df + result = df.rows.drop_value_in(cols=['height(ft)'], values=[300, 'nan'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 7, 7, 8, 10], ('Cybertronian', 'bool'): [True, True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_value_in_string(self): + df = self.df + result = df.rows.drop_value_in(cols=['function'], values='Leader', how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_zip_codes(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('zip_codes_test', 'int64'): [90210, 21252, 36104, 99801, 85001, 10]}, force_data_types=True) + result = df.rows.drop_zip_codes(cols=['zip_codes_test'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[91.44, None]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Battle Station')], ('height(ft)', 'float64'): [300.0], ('japanese name', 'object'): [['Metroflex']], ('last date seen', 'object'): ['2011/04/10'], ('last position seen', 'object'): [None], ('rank', 'int64'): [8], ('Cybertronian', 'bool'): [False], ('Date Type', 'datetime64[ns]'): [Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['Battle Station'], ('names', 'object'): ['Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [nan], ('zip_codes_test', 'int64'): [10]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_zip_codes_all(self): + df = self.df + result = df.rows.drop_zip_codes(cols='*', how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_zip_codes_multiple(self): + df = self.df + result = df.rows.drop_zip_codes(cols=['NullType', 'weight(t)', 'japanese name'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_zip_codes_numeric(self): + df = self.df + result = df.rows.drop_zip_codes(cols=['height(ft)'], how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_drop_zip_codes_string(self): + df = self.df + result = df.rows.drop_zip_codes(cols=['names'], how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_duplicated_all(self): + df = self.df + result = df.rows.duplicated(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_duplicated_all_first(self): + df = self.df + result = df.rows.duplicated(cols='*', keep='first', drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_duplicated_all_last(self): + df = self.df + result = df.rows.duplicated(cols='*', keep='last', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_duplicated_multiple(self): + df = self.df + result = df.rows.duplicated(cols=['NullType', 'timestamp', 'Cybertronian'], keep='first', drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [7, 7, 8, 10], ('Cybertronian', 'bool'): [True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_duplicated_multiple_first(self): + df = self.df + result = df.rows.duplicated(cols=['NullType', 'timestamp', 'Cybertronian'], keep='first', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[8.5344, 4300.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', None], ('rank', 'int64'): [10, 8], ('Cybertronian', 'bool'): [True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Leader', 'Battle Station'], ('names', 'object'): ['Optimus', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_duplicated_multiple_last(self): + df = self.df + result = df.rows.duplicated(cols=['NullType', 'timestamp', 'Cybertronian'], keep='first', drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [7, 7, 8, 10], ('Cybertronian', 'bool'): [True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_duplicated_numeric(self): + df = self.df + result = df.rows.duplicated(cols=['rank'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[7.9248, 4000.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Security'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [26.0, nan, 300.0], ('japanese name', 'object'): [['Roadbuster'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2014/07/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['37.789563,-122.400356', None, None], ('rank', 'int64'): [7, 10, 8], ('Cybertronian', 'bool'): [True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Security', 'None', 'Battle Station'], ('names', 'object'): ['ironhide&', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.0, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_duplicated_numeric_first(self): + df = self.df + result = df.rows.duplicated(cols=['rank'], keep='first', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [3.9624, 1800.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'First Lieutenant')], ('height(ft)', 'float64'): [-28.0, 17.0, 13.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Meister']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2013/06/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '33.670666,-117.841553'], ('rank', 'int64'): [10, 7, 8], ('Cybertronian', 'bool'): [True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2013-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'First Lieutenant'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'Jazz'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 1.8]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_duplicated_numeric_last(self): + df = self.df + result = df.rows.duplicated(cols=['rank'], keep='last', drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [3.9624, 1800.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'First Lieutenant')], ('height(ft)', 'float64'): [-28.0, 17.0, 13.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Meister']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2013/06/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '33.670666,-117.841553'], ('rank', 'int64'): [10, 7, 8], ('Cybertronian', 'bool'): [True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2013-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'First Lieutenant'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'Jazz'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 1.8]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_duplicated_string(self): + df = self.df + result = df.rows.duplicated(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_duplicated_string_first(self): + df = self.df + result = df.rows.duplicated(cols=['names'], keep='first', drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_duplicated_string_last(self): + df = self.df + result = df.rows.duplicated(cols=['names'], keep='last', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_email(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('email_test', 'object'): ['an@example.com', 'thisisatest@gmail.com', 'somename@hotmail.com', 'an@outlook.com', 'anexample@mail.com', 'example@yahoo.com']}, force_data_types=True) + result = df.rows.email(cols=['email_test'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('email_test', 'object'): ['an@example.com', 'thisisatest@gmail.com', 'somename@hotmail.com', 'an@outlook.com', 'anexample@mail.com', 'example@yahoo.com']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_email_all(self): + df = self.df + result = df.rows.email(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_email_multiple(self): + df = self.df + result = df.rows.email(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_email_numeric(self): + df = self.df + result = df.rows.email(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_email_string(self): + df = self.df + result = df.rows.email(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_empty_all(self): + df = self.df + result = df.rows.empty(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_empty_multiple(self): + df = self.df + result = df.rows.empty(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_empty_numeric(self): + df = self.df + result = df.rows.empty(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_empty_string(self): + df = self.df + result = df.rows.empty(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_ends_with_all(self): + df = self.df + result = df.rows.ends_with(cols='*', value=']', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_ends_with_multiple(self): + df = self.df + result = df.rows.ends_with(cols=['NullType', 'weight(t)', 'Cybertronian'], value='one', drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_ends_with_numeric(self): + df = self.df + result = df.rows.ends_with(cols=['height(ft)'], value=0, drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_ends_with_string(self): + df = self.df + result = df.rows.ends_with(cols=['function'], value='e', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [7.9248, 4000.0], [3.9624, 1800.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 26.0, 13.0, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Roadbuster'], ['Meister'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2014/07/10', '2013/06/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 7, 8, 8], ('Cybertronian', 'bool'): [True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Security', 'First Lieutenant', 'Battle Station'], ('names', 'object'): ['Optimus', 'ironhide&', 'Jazz', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 4.0, 1.8, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_equal_all(self): + df = self.df + result = df.rows.equal(cols='*', value=10, drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [7, 7, 8, 8], ('Cybertronian', 'bool'): [True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_equal_multiple(self): + df = self.df + result = df.rows.equal(cols=['NullType', 'weight(t)', 'Cybertronian'], value=True, drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_equal_numeric(self): + df = self.df + result = df.rows.equal(cols=['height(ft)'], value=300, drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[91.44, None]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Battle Station')], ('height(ft)', 'float64'): [300.0], ('japanese name', 'object'): [['Metroflex']], ('last date seen', 'object'): ['2011/04/10'], ('last position seen', 'object'): [None], ('rank', 'int64'): [8], ('Cybertronian', 'bool'): [False], ('Date Type', 'datetime64[ns]'): [Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['Battle Station'], ('names', 'object'): ['Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_equal_string(self): + df = self.df + result = df.rows.equal(cols=['function'], value='Leader', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_expression_all_colname(self): + df = self.df + result = df.rows.expression(where='last position seen', drop=False, how='any') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_expression_all_expression(self): + df = self.df + result = df.rows.expression(cols='*', where='df["rank"]>8', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [7, 7, 8, 8], ('Cybertronian', 'bool'): [True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_expression_multiple_colname(self): + df = self.df + result = df.rows.expression(where='NullType', drop=False, how='all') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_expression_multiple_expression(self): + df = self.df + result = df.rows.expression(where='df["Cybertronian"]==False', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 7, 7, 8, 10], ('Cybertronian', 'bool'): [True, True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_expression_numeric_colname(self): + df = self.df + result = df.rows.expression(where='height(ft)', drop=False, how='all') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_expression_numeric_expression(self): + df = self.df + result = df.rows.expression(where='df["height(ft)"]>=0', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[8.5344, 4300.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'None')], ('height(ft)', 'float64'): [-28.0, nan], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Megatron']], ('last date seen', 'object'): ['2016/09/10', '2012/05/10'], ('last position seen', 'object'): ['19.442735,-99.201111', None], ('rank', 'int64'): [10, 10], ('Cybertronian', 'bool'): [True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Leader', 'None'], ('names', 'object'): ['Optimus', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_expression_string_colname(self): + df = self.df + result = df.rows.expression(where='function', drop=False, how='any') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_expression_string_expression(self): + df = self.df + result = df.rows.expression(where='df["function"]=="Leader"', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_find_all(self): + df = self.df + result = df.rows.find(cols='*', value='None', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_find_multiple(self): + df = self.df + result = df.rows.find(cols=['NullType', 'weight(t)', 'Cybertronian'], value=1, drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_find_numeric(self): + df = self.df + result = df.rows.find(cols=['height(ft)'], value=13, drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[3.9624, 1800.0]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'First Lieutenant')], ('height(ft)', 'float64'): [13.0], ('japanese name', 'object'): [['Meister']], ('last date seen', 'object'): ['2013/06/10'], ('last position seen', 'object'): ['33.670666,-117.841553'], ('rank', 'int64'): [8], ('Cybertronian', 'bool'): [True], ('Date Type', 'datetime64[ns]'): [Timestamp('2013-06-24 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['First Lieutenant'], ('names', 'object'): ['Jazz'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [1.8]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_find_string(self): + df = self.df + result = df.rows.find(cols=['function'], value='Leader', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_float_all(self): + df = self.df + result = df.rows.float(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_float_multiple(self): + df = self.df + result = df.rows.float(cols=['rank', 'last date seen', 'Cybertronian'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_float_numeric(self): + df = self.df + result = df.rows.float(cols=['weight(t)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_float_string(self): + df = self.df + result = df.rows.float(cols=['function'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_gender(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('gender_test', 'object'): ['male', 'female', 'Male', '5.0', 'MALE', 'FEMALE']}, force_data_types=True) + result = df.rows.gender(cols=['gender_test'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage')], ('height(ft)', 'float64'): [-28.0, 17.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534'], ('rank', 'int64'): [10, 7], ('Cybertronian', 'bool'): [True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage'], ('names', 'object'): ['Optimus', 'bumbl#ebéé '], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0], ('gender_test', 'object'): ['male', 'female']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_gender_all(self): + df = self.df + result = df.rows.gender(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_gender_multiple(self): + df = self.df + result = df.rows.gender(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_gender_numeric(self): + df = self.df + result = df.rows.gender(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_gender_string(self): + df = self.df + result = df.rows.gender(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_greater_than_all(self): + df = self.df + result = df.rows.greater_than(cols='*', value=10, drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_greater_than_equal_all(self): + df = self.df + result = df.rows.greater_than_equal(cols='*', value=10, drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_greater_than_equal_multiple(self): + df = self.df + result = df.rows.greater_than_equal(cols=['age', 'NullType', 'weight(t)'], value='-inf', drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_greater_than_equal_numeric(self): + df = self.df + result = df.rows.greater_than_equal(cols=['height(ft)'], value=0.31, drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [7, 7, 8, 8], ('Cybertronian', 'bool'): [True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_greater_than_equal_string(self): + df = self.df + result = df.rows.greater_than_equal(cols=['names'], value=0, drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_greater_than_multiple(self): + df = self.df + result = df.rows.greater_than(cols=['age', 'NullType', 'weight(t)'], value='-inf', drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_greater_than_numeric(self): + df = self.df + result = df.rows.greater_than(cols=['height(ft)'], value=-0.31, drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [7, 7, 8, 8], ('Cybertronian', 'bool'): [True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_greater_than_string(self): + df = self.df + result = df.rows.greater_than(cols=['names'], value=0, drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_http_code(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('http_code_test', 'object'): ['http://github.com/hi-primus/optimus', 'localhost:3000?help=true', 'http://www.images.hi-example.com:54/images.php#id?help=1&freq=2', 'hi-optimus.com', 'http://www.computerhope.com/cgi-bin/search.cgi?q=example%20search&example=test', 'http://www.google.com/search?q=this+is+a+test&client=safari&sxsrf=ALe&source=hp&ei=NL0-y4&iflsig=AINF&oq=this+is+a+test&gs_lcp=MZgBAKA&sclient=gws-wiz&ved=0ah&uact=5']}, force_data_types=True) + result = df.rows.http_code(cols=['http_code_test'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): [], ('http_code_test', 'object'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_http_code_all(self): + df = self.df + result = df.rows.http_code(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_http_code_multiple(self): + df = self.df + result = df.rows.http_code(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_http_code_numeric(self): + df = self.df + result = df.rows.http_code(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_http_code_string(self): + df = self.df + result = df.rows.http_code(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_int_all(self): + df = self.df + result = df.rows.int(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_int_multiple(self): + df = self.df + result = df.rows.int(cols=['rank', 'last date seen', 'Cybertronian'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_int_numeric(self): + df = self.df + result = df.rows.int(cols=['weight(t)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security')], ('height(ft)', 'float64'): [17.0, 26.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356'], ('rank', 'int64'): [7, 7], ('Cybertronian', 'bool'): [True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Espionage', 'Security'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_int_string(self): + df = self.df + result = df.rows.int(cols=['function'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_ip(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('ip_test', 'object'): ['192.0.2.1', '192.158.1.38', '192.168.136.52', '172.16.92.107', '10.63.215.5', '10.0.5.0']}, force_data_types=True) + result = df.rows.ip(cols=['ip_test'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('ip_test', 'object'): ['192.0.2.1', '192.158.1.38', '192.168.136.52', '172.16.92.107', '10.63.215.5', '10.0.5.0']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_ip_all(self): + df = self.df + result = df.rows.ip(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_ip_multiple(self): + df = self.df + result = df.rows.ip(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_ip_numeric(self): + df = self.df + result = df.rows.ip(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_ip_string(self): + df = self.df + result = df.rows.ip(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_less_than_all(self): + df = self.df + result = df.rows.less_than(cols='*', value=10, drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_less_than_equal_all(self): + df = self.df + result = df.rows.less_than_equal(cols='*', value=10, drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_less_than_equal_multiple(self): + df = self.df + result = df.rows.less_than_equal(cols=['age', 'NullType', 'weight(t)'], value='inf', drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_less_than_equal_numeric(self): + df = self.df + result = df.rows.less_than_equal(cols=['height(ft)'], value=0.31, drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[8.5344, 4300.0]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader')], ('height(ft)', 'float64'): [-28.0], ('japanese name', 'object'): [['Inochi', 'Convoy']], ('last date seen', 'object'): ['2016/09/10'], ('last position seen', 'object'): ['19.442735,-99.201111'], ('rank', 'int64'): [10], ('Cybertronian', 'bool'): [True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['Leader'], ('names', 'object'): ['Optimus'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_less_than_equal_string(self): + df = self.df + result = df.rows.less_than_equal(cols=['names'], value=0, drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_less_than_multiple(self): + df = self.df + result = df.rows.less_than(cols=['age', 'NullType', 'weight(t)'], value='inf', drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_less_than_numeric(self): + df = self.df + result = df.rows.less_than(cols=['height(ft)'], value=0.31, drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[8.5344, 4300.0]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader')], ('height(ft)', 'float64'): [-28.0], ('japanese name', 'object'): [['Inochi', 'Convoy']], ('last date seen', 'object'): ['2016/09/10'], ('last position seen', 'object'): ['19.442735,-99.201111'], ('rank', 'int64'): [10], ('Cybertronian', 'bool'): [True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['Leader'], ('names', 'object'): ['Optimus'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_less_than_string(self): + df = self.df + result = df.rows.less_than(cols=['names'], value=0, drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_limit_equal(self): + df = self.df + result = df.rows.limit(count=6) + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_limit_less(self): + df = self.df + result = df.rows.limit(count=2) + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage')], ('height(ft)', 'float64'): [-28.0, 17.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534'], ('rank', 'int64'): [10, 7], ('Cybertronian', 'bool'): [True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage'], ('names', 'object'): ['Optimus', 'bumbl#ebéé '], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_limit_more(self): + df = self.df + result = df.rows.limit(count=150) + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_missing_all(self): + df = self.df + result = df.rows.missing(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_missing_multiple(self): + df = self.df + result = df.rows.missing(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_missing_numeric(self): + df = self.df + result = df.rows.missing(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[None, 5700.0]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'None')], ('height(ft)', 'float64'): [nan], ('japanese name', 'object'): [['Megatron']], ('last date seen', 'object'): ['2012/05/10'], ('last position seen', 'object'): [None], ('rank', 'int64'): [10], ('Cybertronian', 'bool'): [True], ('Date Type', 'datetime64[ns]'): [Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['None'], ('names', 'object'): ['Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_missing_string(self): + df = self.df + result = df.rows.missing(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_nan_all(self): + df = self.df + result = df.rows.nan(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553'], ('rank', 'int64'): [10, 7, 7, 8], ('Cybertronian', 'bool'): [True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_nan_multiple(self): + df = self.df + result = df.rows.nan(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_nan_numeric(self): + df = self.df + result = df.rows.nan(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[None, 5700.0]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'None')], ('height(ft)', 'float64'): [nan], ('japanese name', 'object'): [['Megatron']], ('last date seen', 'object'): ['2012/05/10'], ('last position seen', 'object'): [None], ('rank', 'int64'): [10], ('Cybertronian', 'bool'): [True], ('Date Type', 'datetime64[ns]'): [Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['None'], ('names', 'object'): ['Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_nan_string(self): + df = self.df + result = df.rows.nan(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_none_all(self): + df = self.df + result = df.rows.none(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_none_multiple(self): + df = self.df + result = df.rows.none(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_none_numeric(self): + df = self.df + result = df.rows.none(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_none_string(self): + df = self.df + result = df.rows.none(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_not_equal_all(self): + df = self.df + result = df.rows.not_equal(cols='*', value=10, drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_not_equal_multiple(self): + df = self.df + result = df.rows.not_equal(cols=['NullType', 'weight(t)', 'Cybertronian'], value=True, drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[91.44, None]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Battle Station')], ('height(ft)', 'float64'): [300.0], ('japanese name', 'object'): [['Metroflex']], ('last date seen', 'object'): ['2011/04/10'], ('last position seen', 'object'): [None], ('rank', 'int64'): [8], ('Cybertronian', 'bool'): [False], ('Date Type', 'datetime64[ns]'): [Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['Battle Station'], ('names', 'object'): ['Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_not_equal_numeric(self): + df = self.df + result = df.rows.not_equal(cols=['height(ft)'], value=300, drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 7, 7, 8, 10], ('Cybertronian', 'bool'): [True, True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_not_equal_string(self): + df = self.df + result = df.rows.not_equal(cols=['function'], value='Leader', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[8.5344, 4300.0]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader')], ('height(ft)', 'float64'): [-28.0], ('japanese name', 'object'): [['Inochi', 'Convoy']], ('last date seen', 'object'): ['2016/09/10'], ('last position seen', 'object'): ['19.442735,-99.201111'], ('rank', 'int64'): [10], ('Cybertronian', 'bool'): [True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['Leader'], ('names', 'object'): ['Optimus'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_null_all(self): + df = self.df + result = df.rows.null(cols='*', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_null_multiple(self): + df = self.df + result = df.rows.null(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_null_numeric(self): + df = self.df + result = df.rows.null(cols=['height(ft)'], drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 7, 7, 8, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_null_string(self): + df = self.df + result = df.rows.null(cols=['names'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_numeric_all(self): + df = self.df + result = df.rows.numeric(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_numeric_multiple(self): + df = self.df + result = df.rows.numeric(cols=['rank', 'last date seen', 'Cybertronian'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_numeric_numeric(self): + df = self.df + result = df.rows.numeric(cols=['weight(t)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_numeric_string(self): + df = self.df + result = df.rows.numeric(cols=['function'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_object(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('object_test', 'object'): ['1980/04/10', True, None, inf, 'yes', "bytearray(12, 'utf-8')"]}, force_data_types=True) + result = df.rows.object(cols=['object_test'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('object_test', 'object'): ['1980/04/10', True, None, inf, 'yes', "bytearray(12, 'utf-8')"]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_object_all(self): + df = self.df + result = df.rows.object(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_object_multiple(self): + df = self.df + result = df.rows.object(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_object_numeric(self): + df = self.df + result = df.rows.object(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_object_string(self): + df = self.df + result = df.rows.object(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_pattern_all(self): + df = self.df + result = df.rows.pattern(cols='*', pattern='**cc**', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_pattern_multiple(self): + df = self.df + result = df.rows.pattern(cols=['NullType', 'weight(t)', 'Cybertronian'], pattern='****', drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_pattern_numeric(self): + df = self.df + result = df.rows.pattern(cols=['height(ft)'], pattern='##!#', drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_pattern_string(self): + df = self.df + result = df.rows.pattern(cols=['function'], pattern='Ullclc', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_phone_number(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('phone_number_test', 'object'): [5516528967, '55 8395 1284', '+52 55 3913 1941', '+1 (210) 589-6721', 12106920692, '5532592785']}, force_data_types=True) + result = df.rows.phone_number(cols=['phone_number_test'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', None, None], ('rank', 'int64'): [10, 10, 8], ('Cybertronian', 'bool'): [True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 5.7, nan], ('phone_number_test', 'object'): [5516528967, 12106920692, '5532592785']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_phone_number_all(self): + df = self.df + result = df.rows.phone_number(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_phone_number_multiple(self): + df = self.df + result = df.rows.phone_number(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_phone_number_numeric(self): + df = self.df + result = df.rows.phone_number(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_phone_number_string(self): + df = self.df + result = df.rows.phone_number(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_reverse(self): + df = self.df + result = df.rows.reverse() + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[91.44, None], [None, 5700.0], [3.9624, 1800.0], [7.9248, 4000.0], [5.334, 2000.0], [8.5344, 4300.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Battle Station'), bytearray(b'None'), bytearray(b'First Lieutenant'), bytearray(b'Security'), bytearray(b'Espionage'), bytearray(b'Leader')], ('height(ft)', 'float64'): [300.0, nan, 13.0, 26.0, 17.0, -28.0], ('japanese name', 'object'): [['Metroflex'], ['Megatron'], ['Meister'], ['Roadbuster'], ['Bumble', 'Goldback'], ['Inochi', 'Convoy']], ('last date seen', 'object'): ['2011/04/10', '2012/05/10', '2013/06/10', '2014/07/10', '2015/08/10', '2016/09/10'], ('last position seen', 'object'): [None, None, '33.670666,-117.841553', '37.789563,-122.400356', '10.642707,-71.612534', '19.442735,-99.201111'], ('rank', 'int64'): [8, 10, 8, 7, 7, 10], ('Cybertronian', 'bool'): [False, True, True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2011-04-10 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2016-09-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Battle Station', 'None', 'First Lieutenant', 'Security', 'Espionage', 'Leader'], ('names', 'object'): ['Metroplex_)^$', 'Megatron', 'Jazz', 'ironhide&', 'bumbl#ebéé ', 'Optimus'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [nan, 5.7, 1.8, 4.0, 2.0, 4.3]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_social_security_number(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('social_security_number_test', 'object'): [372847278, '551-83-1284', '525 93 1941', '230 89-6721', '121-069 2062', '371847288']}, force_data_types=True) + result = df.rows.social_security_number(cols=['social_security_number_test'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[5.334, 2000.0]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage')], ('height(ft)', 'float64'): [17.0], ('japanese name', 'object'): [['Bumble', 'Goldback']], ('last date seen', 'object'): ['2015/08/10'], ('last position seen', 'object'): ['10.642707,-71.612534'], ('rank', 'int64'): [7], ('Cybertronian', 'bool'): [True], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['Espionage'], ('names', 'object'): ['bumbl#ebéé '], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0], ('social_security_number_test', 'object'): ['551-83-1284']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_social_security_number_all(self): + df = self.df + result = df.rows.social_security_number(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_social_security_number_multiple(self): + df = self.df + result = df.rows.social_security_number(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_social_security_number_numeric(self): + df = self.df + result = df.rows.social_security_number(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_social_security_number_string(self): + df = self.df + result = df.rows.social_security_number(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_sort_all_asc(self): + df = self.df + result = df.rows.sort(cols='*', order='asc') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_sort_all_desc(self): + df = self.df + result = df.rows.sort(cols='*', order='desc') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_sort_multiple_asc(self): + df = self.df + result = df.rows.sort(cols=['rank', 'last date seen', 'Cybertronian'], order='asc') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[7.9248, 4000.0], [5.334, 2000.0], [91.44, None], [3.9624, 1800.0], [None, 5700.0], [8.5344, 4300.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Security'), bytearray(b'Espionage'), bytearray(b'Battle Station'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Leader')], ('height(ft)', 'float64'): [26.0, 17.0, 300.0, 13.0, nan, -28.0], ('japanese name', 'object'): [['Roadbuster'], ['Bumble', 'Goldback'], ['Metroflex'], ['Meister'], ['Megatron'], ['Inochi', 'Convoy']], ('last date seen', 'object'): ['2014/07/10', '2015/08/10', '2011/04/10', '2013/06/10', '2012/05/10', '2016/09/10'], ('last position seen', 'object'): ['37.789563,-122.400356', '10.642707,-71.612534', None, '33.670666,-117.841553', None, '19.442735,-99.201111'], ('rank', 'int64'): [7, 7, 8, 8, 10, 10], ('Cybertronian', 'bool'): [True, True, False, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2011-04-10 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2016-09-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Security', 'Espionage', 'Battle Station', 'First Lieutenant', 'None', 'Leader'], ('names', 'object'): ['ironhide&', 'bumbl#ebéé ', 'Metroplex_)^$', 'Jazz', 'Megatron', 'Optimus'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.0, 2.0, nan, 1.8, 5.7, 4.3]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_sort_multiple_desc(self): + df = self.df + result = df.rows.sort(cols=['rank', 'last date seen', 'Cybertronian'], order='desc') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[7.9248, 4000.0], [5.334, 2000.0], [91.44, None], [3.9624, 1800.0], [None, 5700.0], [8.5344, 4300.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Security'), bytearray(b'Espionage'), bytearray(b'Battle Station'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Leader')], ('height(ft)', 'float64'): [26.0, 17.0, 300.0, 13.0, nan, -28.0], ('japanese name', 'object'): [['Roadbuster'], ['Bumble', 'Goldback'], ['Metroflex'], ['Meister'], ['Megatron'], ['Inochi', 'Convoy']], ('last date seen', 'object'): ['2014/07/10', '2015/08/10', '2011/04/10', '2013/06/10', '2012/05/10', '2016/09/10'], ('last position seen', 'object'): ['37.789563,-122.400356', '10.642707,-71.612534', None, '33.670666,-117.841553', None, '19.442735,-99.201111'], ('rank', 'int64'): [7, 7, 8, 8, 10, 10], ('Cybertronian', 'bool'): [True, True, False, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2011-04-10 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2016-09-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Security', 'Espionage', 'Battle Station', 'First Lieutenant', 'None', 'Leader'], ('names', 'object'): ['ironhide&', 'bumbl#ebéé ', 'Metroplex_)^$', 'Jazz', 'Megatron', 'Optimus'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.0, 2.0, nan, 1.8, 5.7, 4.3]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_sort_single_asc(self): + df = self.df + result = df.rows.sort(cols=['names'], order='asc') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[3.9624, 1800.0], [None, 5700.0], [91.44, None], [8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station'), bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security')], ('height(ft)', 'float64'): [13.0, nan, 300.0, -28.0, 17.0, 26.0], ('japanese name', 'object'): [['Meister'], ['Megatron'], ['Metroflex'], ['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster']], ('last date seen', 'object'): ['2013/06/10', '2012/05/10', '2011/04/10', '2016/09/10', '2015/08/10', '2014/07/10'], ('last position seen', 'object'): ['33.670666,-117.841553', None, None, '19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356'], ('rank', 'int64'): [8, 10, 8, 10, 7, 7], ('Cybertronian', 'bool'): [True, True, False, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00'), Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['First Lieutenant', 'None', 'Battle Station', 'Leader', 'Espionage', 'Security'], ('names', 'object'): ['Jazz', 'Megatron', 'Metroplex_)^$', 'Optimus', 'bumbl#ebéé ', 'ironhide&'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [1.8, 5.7, nan, 4.3, 2.0, 4.0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_sort_single_desc(self): + df = self.df + result = df.rows.sort(cols=['names'], order='desc') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[3.9624, 1800.0], [None, 5700.0], [91.44, None], [8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station'), bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security')], ('height(ft)', 'float64'): [13.0, nan, 300.0, -28.0, 17.0, 26.0], ('japanese name', 'object'): [['Meister'], ['Megatron'], ['Metroflex'], ['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster']], ('last date seen', 'object'): ['2013/06/10', '2012/05/10', '2011/04/10', '2016/09/10', '2015/08/10', '2014/07/10'], ('last position seen', 'object'): ['33.670666,-117.841553', None, None, '19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356'], ('rank', 'int64'): [8, 10, 8, 10, 7, 7], ('Cybertronian', 'bool'): [True, True, False, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00'), Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['First Lieutenant', 'None', 'Battle Station', 'Leader', 'Espionage', 'Security'], ('names', 'object'): ['Jazz', 'Megatron', 'Metroplex_)^$', 'Optimus', 'bumbl#ebéé ', 'ironhide&'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [1.8, 5.7, nan, 4.3, 2.0, 4.0]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_starts_with_all(self): + df = self.df + result = df.rows.starts_with(cols='*', value='N', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_starts_with_multiple(self): + df = self.df + result = df.rows.starts_with(cols=['NullType', 'weight(t)', 'Cybertronian'], value=True, drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_starts_with_numeric(self): + df = self.df + result = df.rows.starts_with(cols=['height(ft)'], value=1, drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_starts_with_string(self): + df = self.df + result = df.rows.starts_with(cols=['function'], value='Lead', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_str_all(self): + df = self.df + result = df.rows.str(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_str_multiple(self): + df = self.df + result = df.rows.str(cols=['rank', 'last date seen', 'Cybertronian'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_str_numeric(self): + df = self.df + result = df.rows.str(cols=['weight(t)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_str_string(self): + df = self.df + result = df.rows.str(cols=['function'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_to_list_all(self): + df = self.df + result = df.rows.to_list(input_cols='*') + expected = [[None, [8.5344, 4300.0], '1980/04/10', bytearray(b'Leader'), -28.0, ['Inochi', 'Convoy'], '2016/09/10', '19.442735,-99.201111', 10, True, Timestamp('2016-09-10 00:00:00'), 5000000, 'Leader', 'Optimus', Timestamp('2014-06-24 00:00:00'), 4.3], [None, [5.334, 2000.0], '1980/04/10', bytearray(b'Espionage'), 17.0, ['Bumble', 'Goldback'], '2015/08/10', '10.642707,-71.612534', 7, True, Timestamp('2015-08-10 00:00:00'), 5000000, 'Espionage', 'bumbl#ebéé ', Timestamp('2014-06-24 00:00:00'), 2.0], [None, [7.9248, 4000.0], '1980/04/10', bytearray(b'Security'), 26.0, ['Roadbuster'], '2014/07/10', '37.789563,-122.400356', 7, True, Timestamp('2014-06-24 00:00:00'), 5000000, 'Security', 'ironhide&', Timestamp('2014-06-24 00:00:00'), 4.0], [None, [3.9624, 1800.0], '1980/04/10', bytearray(b'First Lieutenant'), 13.0, ['Meister'], '2013/06/10', '33.670666,-117.841553', 8, True, Timestamp('2013-06-24 00:00:00'), 5000000, 'First Lieutenant', 'Jazz', Timestamp('2014-06-24 00:00:00'), 1.8], [None, [None, 5700.0], '1980/04/10', bytearray(b'None'), nan, ['Megatron'], '2012/05/10', None, 10, True, Timestamp('2012-05-10 00:00:00'), 5000000, 'None', 'Megatron', Timestamp('2014-06-24 00:00:00'), 5.7], [None, [91.44, None], '1980/04/10', bytearray(b'Battle Station'), 300.0, ['Metroflex'], '2011/04/10', None, 8, False, Timestamp('2011-04-10 00:00:00'), 5000000, 'Battle Station', 'Metroplex_)^$', Timestamp('2014-06-24 00:00:00'), nan]] + self.assertTrue(results_equal(result, expected, decimal=5, assertion=True)) + + def test_rows_to_list_multiple(self): + df = self.df + result = df.rows.to_list(input_cols=['rank', 'last date seen', 'Cybertronian']) + expected = [[10, '2016/09/10', True], [7, '2015/08/10', True], [7, '2014/07/10', True], [8, '2013/06/10', True], [10, '2012/05/10', True], [8, '2011/04/10', False]] + self.assertTrue(results_equal(result, expected, decimal=5, assertion=True)) + + def test_rows_to_list_single(self): + df = self.df + result = df.rows.to_list(input_cols=['names']) + expected = [['Optimus'], ['bumbl#ebéé '], ['ironhide&'], ['Jazz'], ['Megatron'], ['Metroplex_)^$']] + self.assertTrue(results_equal(result, expected, decimal=5, assertion=True)) + + def test_rows_unique_all(self): + df = self.df + result = df.rows.unique(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_unique_all_first(self): + df = self.df + result = df.rows.unique(cols='*', keep='first', drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_unique_all_last(self): + df = self.df + result = df.rows.unique(cols='*', keep='last', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_unique_multiple(self): + df = self.df + result = df.rows.unique(cols=['NullType', 'timestamp', 'Cybertronian'], keep='first', drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[8.5344, 4300.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', None], ('rank', 'int64'): [10, 8], ('Cybertronian', 'bool'): [True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Leader', 'Battle Station'], ('names', 'object'): ['Optimus', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_unique_multiple_first(self): + df = self.df + result = df.rows.unique(cols=['NullType', 'timestamp', 'Cybertronian'], keep='first', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [7, 7, 8, 10], ('Cybertronian', 'bool'): [True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_unique_multiple_last(self): + df = self.df + result = df.rows.unique(cols=['NullType', 'timestamp', 'Cybertronian'], keep='first', drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[8.5344, 4300.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', None], ('rank', 'int64'): [10, 8], ('Cybertronian', 'bool'): [True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['Leader', 'Battle Station'], ('names', 'object'): ['Optimus', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_unique_numeric(self): + df = self.df + result = df.rows.unique(cols=['rank'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [3.9624, 1800.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'First Lieutenant')], ('height(ft)', 'float64'): [-28.0, 17.0, 13.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Meister']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2013/06/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '33.670666,-117.841553'], ('rank', 'int64'): [10, 7, 8], ('Cybertronian', 'bool'): [True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2013-06-24 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'First Lieutenant'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'Jazz'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 1.8]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_unique_numeric_first(self): + df = self.df + result = df.rows.unique(cols=['rank'], keep='first', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[7.9248, 4000.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Security'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [26.0, nan, 300.0], ('japanese name', 'object'): [['Roadbuster'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2014/07/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['37.789563,-122.400356', None, None], ('rank', 'int64'): [7, 10, 8], ('Cybertronian', 'bool'): [True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Security', 'None', 'Battle Station'], ('names', 'object'): ['ironhide&', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.0, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_unique_numeric_last(self): + df = self.df + result = df.rows.unique(cols=['rank'], keep='last', drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[7.9248, 4000.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Security'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [26.0, nan, 300.0], ('japanese name', 'object'): [['Roadbuster'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2014/07/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['37.789563,-122.400356', None, None], ('rank', 'int64'): [7, 10, 8], ('Cybertronian', 'bool'): [True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Security', 'None', 'Battle Station'], ('names', 'object'): ['ironhide&', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.0, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_unique_string(self): + df = self.df + result = df.rows.unique(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_unique_string_first(self): + df = self.df + result = df.rows.unique(cols=['names'], keep='first', drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_unique_string_last(self): + df = self.df + result = df.rows.unique(cols=['names'], keep='last', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_url(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('urls_test', 'object'): ['https://github.com/hi-primus/optimus', 'localhost:3000?help=true', 'http://www.images.hi-example.com:54/images.php#id?help=1&freq=2', 'hi-optimus.com', 'https://www.computerhope.com/cgi-bin/search.cgi?q=example%20search&example=test', 'https://www.google.com/search?q=this+is+a+test&client=safari&sxsrf=ALe&source=hp&ei=NL0-y4&iflsig=AINF&oq=this+is+a+test&gs_lcp=MZgBAKA&sclient=gws-wiz&ved=0ah&uact=5']}, force_data_types=True) + result = df.rows.url(cols=['urls_test'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [7.9248, 4000.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Security'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 26.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Roadbuster'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2014/07/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '37.789563,-122.400356', None, None], ('rank', 'int64'): [10, 7, 10, 8], ('Cybertronian', 'bool'): [True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Security', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'ironhide&', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 4.0, 5.7, nan], ('urls_test', 'object'): ['https://github.com/hi-primus/optimus', 'http://www.images.hi-example.com:54/images.php#id?help=1&freq=2', 'https://www.computerhope.com/cgi-bin/search.cgi?q=example%20search&example=test', 'https://www.google.com/search?q=this+is+a+test&client=safari&sxsrf=ALe&source=hp&ei=NL0-y4&iflsig=AINF&oq=this+is+a+test&gs_lcp=MZgBAKA&sclient=gws-wiz&ved=0ah&uact=5']}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_url_all(self): + df = self.df + result = df.rows.url(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_url_multiple(self): + df = self.df + result = df.rows.url(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_url_numeric(self): + df = self.df + result = df.rows.url(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_url_string(self): + df = self.df + result = df.rows.url(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_value_in_all(self): + df = self.df + result = df.rows.value_in(cols='*', values=[10, True, None, 'Jazz'], drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_value_in_multiple(self): + df = self.df + result = df.rows.value_in(cols=['NullType', 'weight(t)', 'Cybertronian'], values=[False, None, 4], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_value_in_numeric(self): + df = self.df + result = df.rows.value_in(cols=['height(ft)'], values=[300, 'nan'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None], ('attributes', 'object'): [[91.44, None]], ('date arrival', 'object'): ['1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Battle Station')], ('height(ft)', 'float64'): [300.0], ('japanese name', 'object'): [['Metroflex']], ('last date seen', 'object'): ['2011/04/10'], ('last position seen', 'object'): [None], ('rank', 'int64'): [8], ('Cybertronian', 'bool'): [False], ('Date Type', 'datetime64[ns]'): [Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000], ('function', 'object'): ['Battle Station'], ('names', 'object'): ['Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_value_in_string(self): + df = self.df + result = df.rows.value_in(cols=['function'], values='Leader', drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_zip_code(self): + df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('zip_code_test', 'int64'): [90210, 21252, 36104, 99801, 85001, 10]}, force_data_types=True) + result = df.rows.zip_code(cols=['zip_code_test'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None], ('rank', 'int64'): [10, 7, 7, 8, 10], ('Cybertronian', 'bool'): [True, True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7], ('zip_code_test', 'int64'): [90210, 21252, 36104, 99801, 85001]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_zip_code_all(self): + df = self.df + result = df.rows.zip_code(cols='*', drop=True, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_zip_code_multiple(self): + df = self.df + result = df.rows.zip_code(cols=['NullType', 'weight(t)', 'japanese name'], drop=False, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_zip_code_numeric(self): + df = self.df + result = df.rows.zip_code(cols=['height(ft)'], drop=False, how='any') + expected = self.create_dataframe(dict={('NullType', 'object'): [], ('attributes', 'object'): [], ('date arrival', 'object'): [], ('function(binary)', 'object'): [], ('height(ft)', 'float64'): [], ('japanese name', 'object'): [], ('last date seen', 'object'): [], ('last position seen', 'object'): [], ('rank', 'int64'): [], ('Cybertronian', 'bool'): [], ('Date Type', 'datetime64[ns]'): [], ('age', 'int64'): [], ('function', 'object'): [], ('names', 'object'): [], ('timestamp', 'datetime64[ns]'): [], ('weight(t)', 'float64'): []}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_zip_code_string(self): + df = self.df + result = df.rows.zip_code(cols=['names'], drop=True, how='all') + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + +class TestRowsDask(TestRowsPandas): + config = {'engine': 'dask', 'n_partitions': 1} + + +class TestRowsPartitionDask(TestRowsPandas): + config = {'engine': 'dask', 'n_partitions': 2} + + +try: + import cudf # pyright: reportMissingImports=false +except: + pass +else: + class TestRowsCUDF(TestRowsPandas): + config = {'engine': 'cudf'} + + +try: + import dask_cudf # pyright: reportMissingImports=false +except: + pass +else: + class TestRowsDC(TestRowsPandas): + config = {'engine': 'dask_cudf', 'n_partitions': 1} + + +try: + import dask_cudf # pyright: reportMissingImports=false +except: + pass +else: + class TestRowsPartitionDC(TestRowsPandas): + config = {'engine': 'dask_cudf', 'n_partitions': 2} + + +try: + import pyspark # pyright: reportMissingImports=false +except: + pass +else: + class TestRowsSpark(TestRowsPandas): + config = {'engine': 'spark'} + + +try: + import vaex # pyright: reportMissingImports=false +except: + pass +else: + class TestRowsVaex(TestRowsPandas): + config = {'engine': 'vaex'} From b1b784c5b6cf7a58b98c0dbe1c852c10e48f8fdf Mon Sep 17 00:00:00 2001 From: Jose Angel Hernao Date: Wed, 15 Sep 2021 21:45:44 -0500 Subject: [PATCH 4/4] Add row tests --- tests/creators/creator_rows.py | 7 ++++ tests/test_created__rows.py | 58 ++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/tests/creators/creator_rows.py b/tests/creators/creator_rows.py index b11c96626..9e6a72740 100644 --- a/tests/creators/creator_rows.py +++ b/tests/creators/creator_rows.py @@ -41,6 +41,13 @@ def create(): t.create(method="rows.append", variant="multiple_some_cols", dfs=[df2,df3], names_map={"First":["last position seen","product","ip_test"],"Second":["date arrival","firstName","object_test"],"Third":["names","lastName","email_test"]}) t.create(method="rows.append", variant="multiple_one_col", dfs=[df2,df3], names_map={"Only":["attributes","dummyCol","object_test"]}) + t.create(method="rows.select", variant="mask", expr=df.mask.none("last position seen")) + t.create(method="rows.select", variant="expression", expr=df["height(ft)"]>15) + t.create(method="rows.select", variant="col_name_all", expr="*", contains="a") + t.create(method="rows.select", variant="col_name_numeric", expr=["height(ft)"], contains="0", flags=0, na=True, regex=False) + t.create(method="rows.select", variant="col_name_string", expr=["function"], contains="Le.", case=True, flags=3, na=False, regex=True) + t.create(method="rows.select", variant="col_name_multiple", expr=["NullType", "weight(t)", "Cybertronian"], contains="T|N", case=True, flags=1, na=True, regex=True) + t.create(method="rows.count") t.create(method="rows.to_list", variant="all", input_cols="*") diff --git a/tests/test_created__rows.py b/tests/test_created__rows.py index 8e8345524..490d3243b 100644 --- a/tests/test_created__rows.py +++ b/tests/test_created__rows.py @@ -2197,6 +2197,64 @@ def test_rows_reverse(self): expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[91.44, None], [None, 5700.0], [3.9624, 1800.0], [7.9248, 4000.0], [5.334, 2000.0], [8.5344, 4300.0]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Battle Station'), bytearray(b'None'), bytearray(b'First Lieutenant'), bytearray(b'Security'), bytearray(b'Espionage'), bytearray(b'Leader')], ('height(ft)', 'float64'): [300.0, nan, 13.0, 26.0, 17.0, -28.0], ('japanese name', 'object'): [['Metroflex'], ['Megatron'], ['Meister'], ['Roadbuster'], ['Bumble', 'Goldback'], ['Inochi', 'Convoy']], ('last date seen', 'object'): ['2011/04/10', '2012/05/10', '2013/06/10', '2014/07/10', '2015/08/10', '2016/09/10'], ('last position seen', 'object'): [None, None, '33.670666,-117.841553', '37.789563,-122.400356', '10.642707,-71.612534', '19.442735,-99.201111'], ('rank', 'int64'): [8, 10, 8, 7, 7, 10], ('Cybertronian', 'bool'): [False, True, True, True, True, True], ('Date Type', 'datetime64[ns]'): [Timestamp('2011-04-10 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2016-09-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Battle Station', 'None', 'First Lieutenant', 'Security', 'Espionage', 'Leader'], ('names', 'object'): ['Metroplex_)^$', 'Megatron', 'Jazz', 'ironhide&', 'bumbl#ebéé ', 'Optimus'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [nan, 5.7, 1.8, 4.0, 2.0, 4.3]}, force_data_types=True) self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + def test_rows_select_col_name_all(self): + df = self.df + result = df.rows.select(expr='*', contains='a') + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_select_col_name_multiple(self): + df = self.df + result = df.rows.select(expr=['NullType', 'weight(t)', 'Cybertronian'], contains='T|N', case=True, flags=1, na=True, regex=True) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_select_col_name_numeric(self): + df = self.df + result = df.rows.select(expr=['height(ft)'], contains='0', flags=0, na=True, regex=False) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_select_col_name_string(self): + df = self.df + result = df.rows.select(expr=['function'], contains='Le.', case=True, flags=3, na=False, regex=True) + # The following value does not represent a correct output of the operation + expected = self.dict + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_select_expression(self): + df = self.df + result = df.rows.select(expr= height(ft) + (bool) +------------ + 0 + 1 + 1 + 0 + 0 + 1 +) + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None, None], ('attributes', 'object'): [[5.334, 2000.0], [7.9248, 4000.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [17.0, 26.0, 300.0], ('japanese name', 'object'): [['Bumble', 'Goldback'], ['Roadbuster'], ['Metroflex']], ('last date seen', 'object'): ['2015/08/10', '2014/07/10', '2011/04/10'], ('last position seen', 'object'): ['10.642707,-71.612534', '37.789563,-122.400356', None], ('rank', 'int64'): [7, 7, 8], ('Cybertronian', 'bool'): [True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000], ('function', 'object'): ['Espionage', 'Security', 'Battle Station'], ('names', 'object'): ['bumbl#ebéé ', 'ironhide&', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [2.0, 4.0, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + + def test_rows_select_mask(self): + df = self.df + result = df.rows.select(expr= last position seen + (bool) +-------------------- + 0 + 0 + 0 + 0 + 1 + 1 +) + expected = self.create_dataframe(dict={('NullType', 'object'): [None, None], ('attributes', 'object'): [[None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [nan, 300.0], ('japanese name', 'object'): [['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2012/05/10', '2011/04/10'], ('last position seen', 'object'): [None, None], ('rank', 'int64'): [10, 8], ('Cybertronian', 'bool'): [True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000], ('function', 'object'): ['None', 'Battle Station'], ('names', 'object'): ['Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [5.7, nan]}, force_data_types=True) + self.assertTrue(result.equals(expected, decimal=True, assertion=True)) + def test_rows_social_security_number(self): df = self.create_dataframe(dict={('NullType', 'object'): [None, None, None, None, None, None], ('attributes', 'object'): [[8.5344, 4300.0], [5.334, 2000.0], [7.9248, 4000.0], [3.9624, 1800.0], [None, 5700.0], [91.44, None]], ('date arrival', 'object'): ['1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10', '1980/04/10'], ('function(binary)', 'object'): [bytearray(b'Leader'), bytearray(b'Espionage'), bytearray(b'Security'), bytearray(b'First Lieutenant'), bytearray(b'None'), bytearray(b'Battle Station')], ('height(ft)', 'float64'): [-28.0, 17.0, 26.0, 13.0, nan, 300.0], ('japanese name', 'object'): [['Inochi', 'Convoy'], ['Bumble', 'Goldback'], ['Roadbuster'], ['Meister'], ['Megatron'], ['Metroflex']], ('last date seen', 'object'): ['2016/09/10', '2015/08/10', '2014/07/10', '2013/06/10', '2012/05/10', '2011/04/10'], ('last position seen', 'object'): ['19.442735,-99.201111', '10.642707,-71.612534', '37.789563,-122.400356', '33.670666,-117.841553', None, None], ('rank', 'int64'): [10, 7, 7, 8, 10, 8], ('Cybertronian', 'bool'): [True, True, True, True, True, False], ('Date Type', 'datetime64[ns]'): [Timestamp('2016-09-10 00:00:00'), Timestamp('2015-08-10 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2013-06-24 00:00:00'), Timestamp('2012-05-10 00:00:00'), Timestamp('2011-04-10 00:00:00')], ('age', 'int64'): [5000000, 5000000, 5000000, 5000000, 5000000, 5000000], ('function', 'object'): ['Leader', 'Espionage', 'Security', 'First Lieutenant', 'None', 'Battle Station'], ('names', 'object'): ['Optimus', 'bumbl#ebéé ', 'ironhide&', 'Jazz', 'Megatron', 'Metroplex_)^$'], ('timestamp', 'datetime64[ns]'): [Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00'), Timestamp('2014-06-24 00:00:00')], ('weight(t)', 'float64'): [4.3, 2.0, 4.0, 1.8, 5.7, nan], ('social_security_number_test', 'object'): [372847278, '551-83-1284', '525 93 1941', '230 89-6721', '121-069 2062', '371847288']}, force_data_types=True) result = df.rows.social_security_number(cols=['social_security_number_test'], drop=False, how='any')