Python pandas.core.index._get_combined_index() Examples

The following are 7 code examples of pandas.core.index._get_combined_index(). 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.core.index , or try the search function .
Example #1
Source File: test_base.py    From recruit with Apache License 2.0 5 votes vote down vote up
def test_get_combined_index(self):
        result = _get_combined_index([])
        expected = Index([])
        tm.assert_index_equal(result, expected) 
Example #2
Source File: test_base.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_get_combined_index(self):
        result = _get_combined_index([])
        expected = Index([])
        tm.assert_index_equal(result, expected) 
Example #3
Source File: frame.py    From Computable with MIT License 5 votes vote down vote up
def _list_of_series_to_arrays(data, columns, coerce_float=False, dtype=None):
    from pandas.core.index import _get_combined_index

    if columns is None:
        columns = _get_combined_index([
            s.index for s in data if getattr(s, 'index', None) is not None
        ])

    indexer_cache = {}

    aligned_values = []
    for s in data:
        index = getattr(s, 'index', None)
        if index is None:
            index = _default_index(len(s))

        if id(index) in indexer_cache:
            indexer = indexer_cache[id(index)]
        else:
            indexer = indexer_cache[id(index)] = index.get_indexer(columns)

        values = _values_from_object(s)
        aligned_values.append(com.take_1d(values, indexer))

    values = np.vstack(aligned_values)

    if values.dtype == np.object_:
        content = list(values.T)
        return _convert_object_array(content, columns, dtype=dtype,
                                     coerce_float=coerce_float)
    else:
        return values.T, columns 
Example #4
Source File: test_base.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def test_get_combined_index(self):
        result = _get_combined_index([])
        expected = Index([])
        tm.assert_index_equal(result, expected) 
Example #5
Source File: test_base.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def test_get_combined_index(self):
        result = _get_combined_index([])
        tm.assert_index_equal(result, Index([])) 
Example #6
Source File: test_base.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_get_combined_index(self):
        result = _get_combined_index([])
        expected = Index([])
        tm.assert_index_equal(result, expected) 
Example #7
Source File: test_base.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_get_combined_index(self):
        result = _get_combined_index([])
        expected = Index([])
        tm.assert_index_equal(result, expected)