Skip to content

Commit 9a31bdd

Browse files
authored
CLN: rename get_block_values, simplify (#32521)
1 parent b9762eb commit 9a31bdd

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pandas/_libs/src/ujson/python/objToJSON.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,9 @@ static PyObject *get_values(PyObject *obj) {
237237
}
238238
}
239239

240-
if ((values == NULL) && PyObject_HasAttrString(obj, "get_block_values")) {
240+
if ((values == NULL) && PyObject_HasAttrString(obj, "get_block_values_for_json")) {
241241
PRINTMARK();
242-
values = PyObject_CallMethod(obj, "get_block_values", NULL);
242+
values = PyObject_CallMethod(obj, "get_block_values_for_json", NULL);
243243

244244
if (values == NULL) {
245245
// Clear so we can subsequently try another method

pandas/core/internals/blocks.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,12 @@ def get_values(self, dtype=None):
231231
return self.values.astype(object)
232232
return self.values
233233

234-
def get_block_values(self, dtype=None):
234+
def get_block_values_for_json(self) -> np.ndarray:
235235
"""
236-
This is used in the JSON C code
236+
This is used in the JSON C code.
237237
"""
238-
return self.get_values(dtype=dtype)
238+
# TODO(2DEA): reshape will be unnecessary with 2D EAs
239+
return np.asarray(self.values).reshape(self.shape)
239240

240241
def to_dense(self):
241242
return self.values.view()

0 commit comments

Comments
 (0)