Python pandas._libs.lib.fast_unique_multiple_list_gen() Examples
The following are 7
code examples of pandas._libs.lib.fast_unique_multiple_list_gen().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pandas._libs.lib
, or try the search function
.
Example #1
Source File: test_lib.py From recruit with Apache License 2.0 | 5 votes |
def test_fast_unique_multiple_list_gen_sort(self): keys = [['p', 'a'], ['n', 'd'], ['a', 's']] gen = (key for key in keys) expected = np.array(['a', 'd', 'n', 'p', 's']) out = lib.fast_unique_multiple_list_gen(gen, sort=True) tm.assert_numpy_array_equal(np.array(out), expected) gen = (key for key in keys) expected = np.array(['p', 'a', 'n', 'd', 's']) out = lib.fast_unique_multiple_list_gen(gen, sort=False) tm.assert_numpy_array_equal(np.array(out), expected)
Example #2
Source File: construction.py From recruit with Apache License 2.0 | 5 votes |
def _list_of_dict_to_arrays(data, columns, coerce_float=False, dtype=None): if columns is None: gen = (list(x.keys()) for x in data) sort = not any(isinstance(d, OrderedDict) for d in data) columns = lib.fast_unique_multiple_list_gen(gen, sort=sort) # assure that they are of the base dict class and not of derived # classes data = [(type(d) is dict) and d or dict(d) for d in data] content = list(lib.dicts_to_array(data, list(columns)).T) return _convert_object_array(content, columns, dtype=dtype, coerce_float=coerce_float)
Example #3
Source File: test_lib.py From vnpy_crypto with MIT License | 5 votes |
def test_fast_unique_multiple_list_gen_sort(self): keys = [['p', 'a'], ['n', 'd'], ['a', 's']] gen = (key for key in keys) expected = np.array(['a', 'd', 'n', 'p', 's']) out = lib.fast_unique_multiple_list_gen(gen, sort=True) tm.assert_numpy_array_equal(np.array(out), expected) gen = (key for key in keys) expected = np.array(['p', 'a', 'n', 'd', 's']) out = lib.fast_unique_multiple_list_gen(gen, sort=False) tm.assert_numpy_array_equal(np.array(out), expected)
Example #4
Source File: test_lib.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_fast_unique_multiple_list_gen_sort(self): keys = [['p', 'a'], ['n', 'd'], ['a', 's']] gen = (key for key in keys) expected = np.array(['a', 'd', 'n', 'p', 's']) out = lib.fast_unique_multiple_list_gen(gen, sort=True) tm.assert_numpy_array_equal(np.array(out), expected) gen = (key for key in keys) expected = np.array(['p', 'a', 'n', 'd', 's']) out = lib.fast_unique_multiple_list_gen(gen, sort=False) tm.assert_numpy_array_equal(np.array(out), expected)
Example #5
Source File: construction.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def _list_of_dict_to_arrays(data, columns, coerce_float=False, dtype=None): if columns is None: gen = (list(x.keys()) for x in data) sort = not any(isinstance(d, OrderedDict) for d in data) columns = lib.fast_unique_multiple_list_gen(gen, sort=sort) # assure that they are of the base dict class and not of derived # classes data = [(type(d) is dict) and d or dict(d) for d in data] content = list(lib.dicts_to_array(data, list(columns)).T) return _convert_object_array(content, columns, dtype=dtype, coerce_float=coerce_float)
Example #6
Source File: test_lib.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_fast_unique_multiple_list_gen_sort(self): keys = [['p', 'a'], ['n', 'd'], ['a', 's']] gen = (key for key in keys) expected = np.array(['a', 'd', 'n', 'p', 's']) out = lib.fast_unique_multiple_list_gen(gen, sort=True) tm.assert_numpy_array_equal(np.array(out), expected) gen = (key for key in keys) expected = np.array(['p', 'a', 'n', 'd', 's']) out = lib.fast_unique_multiple_list_gen(gen, sort=False) tm.assert_numpy_array_equal(np.array(out), expected)
Example #7
Source File: test_lib.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_fast_unique_multiple_list_gen_sort(self): keys = [['p', 'a'], ['n', 'd'], ['a', 's']] gen = (key for key in keys) expected = np.array(['a', 'd', 'n', 'p', 's']) out = lib.fast_unique_multiple_list_gen(gen, sort=True) tm.assert_numpy_array_equal(np.array(out), expected) gen = (key for key in keys) expected = np.array(['p', 'a', 'n', 'd', 's']) out = lib.fast_unique_multiple_list_gen(gen, sort=False) tm.assert_numpy_array_equal(np.array(out), expected)