Skip to content

Commit

Permalink
review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbrn committed Apr 17, 2024
1 parent bd4ed37 commit 47c0e23
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
2 changes: 1 addition & 1 deletion src/nested_pandas/series/dtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class NestedDtype(ExtensionDtype):
"""Attributes to use as metadata for __eq__ and __hash__"""

@property
def na_value(self) -> pd.NA:
def na_value(self) -> Type[pd.NA]:
"""The missing value for this dtype"""
return pd.NA

Expand Down
7 changes: 0 additions & 7 deletions src/nested_pandas/series/ext_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,6 @@ def to_numpy(self, dtype: None = None, copy: bool = False, na_value: Any = no_de
# Hack with np.empty is the only way to force numpy to create 1-d array of objects
result = np.empty(shape=array.shape, dtype=object)

# TODO: delete block once confirmed NA is better to return
# fill NaNs - Fill with an empty dictionary using the same columns
# nan_vals = pd.isna(array)
# if sum(nan_vals) > 0:
# na_idx = np.where(nan_vals)
# array[na_idx] = {key: [] for key in array[np.where(~nan_vals)[0][0]].keys()}

# We do copy=False here because user's 'copy' is already handled by ArrowExtensionArray.to_numpy
result[:] = [pd.DataFrame(value, copy=False) if not pd.isna(value) else pd.NA for value in array]
return result
Expand Down

0 comments on commit 47c0e23

Please sign in to comment.