Skip to content

Commit 9981fb1

Browse files
Fix segfault with printing dataframe
GH 46848
1 parent d2a7eff commit 9981fb1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pandas/_libs/algos_take_helper.pxi.in

+7
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,15 @@ def take_2d_axis1_{{name}}_{{dest}}(ndarray[{{c_type_in}}, ndim=2] values,
183183
{{if c_type_in == "uint8_t" and c_type_out == "object"}}
184184
out[i, j] = True if values[i, idx] > 0 else False
185185
{{else}}
186+
{{if c_type_in == "object"}} # GH46848
187+
if values[i][idx] is None:
188+
out[i, j] = None
189+
else:
190+
out[i, j] = values[i, idx]
191+
{{else}}
186192
out[i, j] = values[i, idx]
187193
{{endif}}
194+
{{endif}}
188195

189196

190197
@cython.wraparound(False)

0 commit comments

Comments
 (0)