Skip to content

Commit

Permalink
evaluate datatype without pandas for strings (#601) (#602)
Browse files Browse the repository at this point in the history
Co-authored-by: Fred Lefévère-Laoide <[email protected]>
  • Loading branch information
FredLL-Avaiga and Fred Lefévère-Laoide authored Dec 12, 2023
1 parent 24ddd20 commit 83b6899
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 1 addition & 3 deletions frontend/taipy-gui/src/components/Taipy/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ const Field = (props: TaipyFieldProps) => {
return (
<Tooltip title={hover || ""}>
{mode == "pre" ? (
<pre className={className} id={id}>
{value}
</pre>
<pre className={className} id={id}>{value}</pre>
) : mode == "markdown" || mode == "md" ? (
<Markdown className={className}>{value}</Markdown>
) : raw || mode == "raw" ? (
Expand Down
13 changes: 7 additions & 6 deletions taipy/gui/utils/datatype.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@


def _get_data_type(value):
if pd.api.types.is_bool_dtype(value):
return "bool"
elif pd.api.types.is_integer_dtype(value):
return "int"
elif pd.api.types.is_float_dtype(value):
return "float"
if not isinstance(value, str):
if pd.api.types.is_bool_dtype(value):
return "bool"
elif pd.api.types.is_integer_dtype(value):
return "int"
elif pd.api.types.is_float_dtype(value):
return "float"
return re.match(r"^<class '(.*\.)?(.*?)(\d\d)?'>", str(type(value))).group(2)

0 comments on commit 83b6899

Please sign in to comment.