MCPcopy Create free account
hub / github.com/apache/arrow / test_category

Method test_category

python/pyarrow/tests/test_pandas.py:3136–3160  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3134 pool.join()
3135
3136 def test_category(self):
3137 repeats = 5
3138 v1 = ['foo', None, 'bar', 'qux', np.nan]
3139 v2 = [4, 5, 6, 7, 8]
3140 v3 = [b'foo', None, b'bar', b'qux', np.nan]
3141
3142 arrays = {
3143 'cat_strings': pd.Categorical(v1 * repeats),
3144 'cat_strings_with_na': pd.Categorical(v1 * repeats,
3145 categories=['foo', 'bar']),
3146 'cat_ints': pd.Categorical(v2 * repeats),
3147 'cat_binary': pd.Categorical(v3 * repeats),
3148 'cat_strings_ordered': pd.Categorical(
3149 v1 * repeats, categories=['bar', 'qux', 'foo'],
3150 ordered=True),
3151 'ints': v2 * repeats,
3152 'ints2': v2 * repeats,
3153 'strings': v1 * repeats,
3154 'strings2': v1 * repeats,
3155 'strings3': v3 * repeats}
3156 df = pd.DataFrame(arrays)
3157 _check_pandas_roundtrip(df)
3158
3159 for k in arrays:
3160 _check_array_roundtrip(arrays[k])
3161
3162 def test_category_implicit_from_pandas(self):
3163 # ARROW-3374

Callers

nothing calls this directly

Calls 2

_check_array_roundtripFunction · 0.85
_check_pandas_roundtripFunction · 0.70

Tested by

no test coverage detected