Skip to content

Commit

Permalink
Merge pull request #414 from Renumics/fix/edit-pandas-windows
Browse files Browse the repository at this point in the history
Fix/edit pandas windows
  • Loading branch information
neindochoh authored Feb 8, 2024
2 parents 421d671 + 8daebb6 commit f94ef40
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
7 changes: 6 additions & 1 deletion renumics/spotlight/data_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ def get_column_metadata(self, column_name: str) -> ColumnMetadata:
tags=[],
computed=True,
)
return self._data_source.get_column_metadata(column_name)
metadata = self._data_source.get_column_metadata(column_name)
if spotlight_dtypes.is_unknown_dtype(
self._data_source.intermediate_dtypes[column_name]
):
metadata.editable = False
return metadata

def get_converted_values(
self,
Expand Down
17 changes: 13 additions & 4 deletions renumics/spotlight/dtypes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,14 @@ def register_dtype(dtype: DType, aliases: Optional[list] = None) -> None:
"""
register_dtype(video_dtype, [Video])

mixed_dtype = DType("mixed")
unknown_dtype = DType("unknown")
"""
Unknown or mixed dtype. Aliases: `"mixed"`.
Unknown dtype. Aliases: `"unknown"`.
"""

any_dtype = DType("any")
"""
Unknown dtype which accepts any value. Aliases: `"any"`.
"""

file_dtype = DType("file")
Expand Down Expand Up @@ -566,8 +571,12 @@ def is_sequence_dtype(dtype: DType) -> TypeGuard[SequenceDType]:
return dtype.name == "Sequence"


def is_mixed_dtype(dtype: DType) -> bool:
return dtype.name == "mixed"
def is_unknown_dtype(dtype: DType) -> bool:
return dtype.name == "unknown"


def is_any_dtype(dtype: DType) -> bool:
return dtype.name == "any"


def is_scalar_dtype(dtype: DType) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion renumics/spotlight_plugins/core/pandas_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,4 @@ def _determine_intermediate_dtype(column: pd.Series) -> dtypes.DType:
return dtypes.datetime_dtype
if pd.api.types.is_string_dtype(column):
return dtypes.str_dtype
return dtypes.mixed_dtype
return dtypes.any_dtype

0 comments on commit f94ef40

Please sign in to comment.