Change dataframe display with int instrad of floats
Browse files- recommender_system.py +10 -4
recommender_system.py
CHANGED
@@ -324,13 +324,19 @@ The dataset used for these computations is the following:
|
|
324 |
)
|
325 |
st.sidebar.markdown(SIDEBAR_DESCRIPTION)
|
326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
|
328 |
# Show the data
|
329 |
st.dataframe(
|
330 |
-
|
331 |
-
COLUMN_NOT_DISPLAY,
|
332 |
-
axis=1,
|
333 |
-
)
|
334 |
)
|
335 |
|
336 |
st.markdown("## Interactive suggestion")
|
|
|
324 |
)
|
325 |
st.sidebar.markdown(SIDEBAR_DESCRIPTION)
|
326 |
|
327 |
+
to_display = data.drop(
|
328 |
+
COLUMN_NOT_DISPLAY,
|
329 |
+
axis=1,
|
330 |
+
)
|
331 |
+
|
332 |
+
# Convert to int just to display the column without trailing decimals.
|
333 |
+
# @note: I know I can use the "format" function of pandas, but I found out
|
334 |
+
# it is super slow when fomratting large tables.
|
335 |
+
to_display["Price"] = to_display["Price"].astype(int)
|
336 |
|
337 |
# Show the data
|
338 |
st.dataframe(
|
339 |
+
to_display,
|
|
|
|
|
|
|
340 |
)
|
341 |
|
342 |
st.markdown("## Interactive suggestion")
|