Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
st.subheader("Unstyled")
st.dataframe(df)
st.subheader("Custom formatting")
st.dataframe(df.style.format("{:.2%}"))
st.subheader("Colors")
st.dataframe(
df.style.applymap(color_negative_red).apply(
highlight_max, color="darkorange", axis=0
)
)
st.subheader("Add rows")
x = st.dataframe(
df.style.set_properties(**{"background-color": "black", "color": "lawngreen"})
)
x.add_rows(
pd.DataFrame(np.random.randn(3, 5)).style.set_properties(
**{"background-color": "lawngreen", "color": "black"}
)
)
x.add_rows(
pd.DataFrame(np.random.randn(2, 5)).style.format(
lambda value: "" if value > 0 else "*"
)
"years."
)
st.sidebar.table(
pd.DataFrame.from_dict(
wins_turnover_corr, orient="index", columns=["correlation"]
).round(2)
)
# Data frame for the plot
fig = get_turnover_vs_wins_plot(roster_turnover, year, teams_colorscale)
st.plotly_chart(fig, width=1080, height=600)
# Show the roster DataFrame
st.header("Minutes Played Breakdown by Team")
selected_team = st.selectbox("Select a team", teams)
st.dataframe(
roster_turnover_pivot(player_minutes, team=selected_team, year=year), width=1080
)
st.text("* The numbers in the table are minutes played")
"Entity labels", nlp.get_pipe("ner").labels, default_labels
)
html = displacy.render(doc, style="ent", options={"ents": labels})
# Newlines seem to mess with the rendering
html = html.replace("\n", " ")
st.write(HTML_WRAPPER.format(html), unsafe_allow_html=True)
attrs = ["text", "label_", "start", "end", "start_char", "end_char"]
if "entity_linker" in nlp.pipe_names:
attrs.append("kb_id_")
data = [
[str(getattr(ent, attr)) for attr in attrs]
for ent in doc.ents
if ent.label_ in labels
]
df = pd.DataFrame(data, columns=attrs)
st.dataframe(df)
if "textcat" in nlp.pipe_names:
st.header("Text Classification")
st.markdown(f"> {text}")
df = pd.DataFrame(doc.cats.items(), columns=("Label", "Score"))
st.dataframe(df)
vector_size = nlp.meta.get("vectors", {}).get("width", 0)
if vector_size:
st.header("Vectors & Similarity")
st.code(nlp.meta["vectors"])
text1 = st.text_input("Text or word 1", "apple")
text2 = st.text_input("Text or word 2", "orange")
doc1 = process_text(spacy_model, text1)
"First name",
"Last name",
"Test1",
"Test2",
"Test3",
"Test4",
"Test Mean",
"Relative diff from 1 to 4 (%)",
]
],
)
# Show Soure
if show_source_data:
st.subheader("Source Data")
st.markdown(f"[{source_url}]({source_url})")
st.dataframe(source_data)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import streamlit as st
import pandas as pd
import numpy as np
st.header("Empty list")
st.write([])
st.header("Empty dataframes")
st.write(np.array(0))
st.write(pd.DataFrame([]))
st.dataframe()
st.dataframe([])
st.dataframe(np.array(0))
st.dataframe(pd.DataFrame([]))
st.header("Empty one-column dataframes")
st.write(np.array([]))
st.dataframe(np.array([]))
st.header("Empty two-column dataframes (only shows 1)")
st.write(pd.DataFrame({"lat": [], "lon": []}))
st.dataframe(pd.DataFrame({"lat": [], "lon": []}))
st.header("Empty tables")
st.table()
st.table([])
st.table(np.array(0))
st.table(pd.DataFrame([]))
"years."
)
st.sidebar.table(
pd.DataFrame.from_dict(
wins_turnover_corr, orient="index", columns=["correlation"]
).round(2)
)
# Data frame for the plot
fig = get_turnover_vs_wins_plot(roster_turnover, year, teams_colorscale)
st.plotly_chart(fig, width=1080, height=600)
# Show the roster DataFrame
st.header("Minutes Played Breakdown by Team")
selected_team = st.selectbox("Select a team", teams)
st.dataframe(
roster_turnover_pivot(player_minutes, team=selected_team, year=year), width=1080
)
st.text("* The numbers in the table are minutes played")
st.markdown('## Rendering')
# Rendering (Second Wave)
crawler = render_data(crawler)
st.markdown('## Indexing')
# Build the index
indexer = index_data(crawler, i_type, title_boost)
st.markdown('# Searching: {}'.format(search_query))
if len(search_query):
data = {'sim_weight':sim_weight, 'pr_weight':pr_weight, 'bert_weight':bert_weight}
df, pre_results = indexer.search_index_st(search_query, **data)
st.markdown('## Ranking Data')
st.dataframe(pre_results.style.highlight_max(axis=0), width=800)
st.markdown('## Search Results')
st.markdown('#### \[Ad\] [{}]({}) \n {} \n {}'.format( 'LOCOMOTIVE® - Enterprise Technical SEO Agency', 'https://locomotive.agency/', 'https://locomotive.agency/', "LOCOMOTIVE® - 2019 U.S. Search Awards 'Best Small SEO Agency'. We are an agency team of enterprise technical, and on-page SEO specialists: Moving you forward."))
for i, row in df.iterrows():
desc = row['description'] if len(row['description']) < 280 else row['description'][:280] + '...'
st.markdown('#### [{}]({}) \n {} \n {}'.format(row['title'], row['url'], row['url'], desc))
else:
st.markdown('You need to enter a search term.')
# limitations under the License.
import streamlit as st
import numpy as np
import pandas as pd
# Explicitly seed the RNG for deterministic results
np.random.seed(0)
data = np.random.randn(100, 100)
df = pd.DataFrame(data)
st.dataframe(df)
st.dataframe(df, 250, 150)
st.dataframe(df, width=250)
st.dataframe(df, height=150)