Skip to content

Streamlit can't mix numpy int64 and int #1065

@komodovaran

Description

@komodovaran

Streamlit version 0.55

Using something like the builtin max() or min() on a Numpy arrays will return int64 rather than int, which causes Streamlit to complain:

import streamlit as st
import numpy as np

n = np.array([1, 2, 3, 4, 5])

l = st.number_input(
    min_value = min(n),
    max_value = max(n),
    value = 3,
    label = "Length",
)
streamlit.errors.StreamlitAPIException: All arguments must be of the same type.
`value` has int type.
`min_value` has int64 type.
`max_value` has int64 type.

Ideally Streamlit should treat them the same, so the end user doesn't have to wrap everything with int() or the likes.

Metadata

Metadata

Assignees

Labels

type:bugSomething isn't working as expected

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions