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

Method test_category

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

Source from the content-addressed store, hash-verified

3071 pool.join()
3072
3073 def test_category(self):
3074 repeats = 5
3075 v1 = ['foo', None, 'bar', 'qux', np.nan]
3076 v2 = [4, 5, 6, 7, 8]
3077 v3 = [b'foo', None, b'bar', b'qux', np.nan]
3078
3079 arrays = {
3080 'cat_strings': pd.Categorical(v1 * repeats),
3081 'cat_strings_with_na': pd.Categorical(v1 * repeats,
3082 categories=['foo', 'bar']),
3083 'cat_ints': pd.Categorical(v2 * repeats),
3084 'cat_binary': pd.Categorical(v3 * repeats),
3085 'cat_strings_ordered': pd.Categorical(
3086 v1 * repeats, categories=['bar', 'qux', 'foo'],
3087 ordered=True),
3088 'ints': v2 * repeats,
3089 'ints2': v2 * repeats,
3090 'strings': v1 * repeats,
3091 'strings2': v1 * repeats,
3092 'strings3': v3 * repeats}
3093 df = pd.DataFrame(arrays)
3094 _check_pandas_roundtrip(df)
3095
3096 for k in arrays:
3097 _check_array_roundtrip(arrays[k])
3098
3099 def test_category_implicit_from_pandas(self):
3100 # 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