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

Method test_category

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

Source from the content-addressed store, hash-verified

3083 pool.join()
3084
3085 def test_category(self):
3086 repeats = 5
3087 v1 = ['foo', None, 'bar', 'qux', np.nan]
3088 v2 = [4, 5, 6, 7, 8]
3089 v3 = [b'foo', None, b'bar', b'qux', np.nan]
3090
3091 arrays = {
3092 'cat_strings': pd.Categorical(v1 * repeats),
3093 'cat_ints': pd.Categorical(v2 * repeats),
3094 'cat_binary': pd.Categorical(v3 * repeats),
3095 'cat_strings_ordered': pd.Categorical(
3096 v1 * repeats, categories=['bar', 'qux', 'foo'],
3097 ordered=True),
3098 'ints': v2 * repeats,
3099 'ints2': v2 * repeats,
3100 'strings': v1 * repeats,
3101 'strings2': v1 * repeats,
3102 'strings3': v3 * repeats}
3103 df = pd.DataFrame(arrays)
3104 _check_pandas_roundtrip(df)
3105
3106 for k in arrays:
3107 _check_array_roundtrip(arrays[k])
3108
3109 def test_category_implicit_from_pandas(self):
3110 # 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