Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +5 -1
src/streamlit_app.py
CHANGED
|
@@ -786,6 +786,9 @@ elif st.session_state.page == 'viewer':
|
|
| 786 |
if line_items:
|
| 787 |
df = pd.DataFrame(line_items)
|
| 788 |
|
|
|
|
|
|
|
|
|
|
| 789 |
# Convert amount fields to numeric
|
| 790 |
amount_fields = ['Invoice_amount_FCY', 'Amount_paid_for_each_invoice',
|
| 791 |
'Outstanding_balance_FCY', 'Discounts_taken_FCY',
|
|
@@ -817,7 +820,8 @@ elif st.session_state.page == 'viewer':
|
|
| 817 |
hide_index=False
|
| 818 |
)
|
| 819 |
|
| 820 |
-
# Convert back to string
|
|
|
|
| 821 |
for field in amount_fields:
|
| 822 |
if field in edited_df.columns:
|
| 823 |
edited_df[field] = edited_df[field].apply(lambda x: str(x) if pd.notna(x) else '')
|
|
|
|
| 786 |
if line_items:
|
| 787 |
df = pd.DataFrame(line_items)
|
| 788 |
|
| 789 |
+
# Set index to start from 1 instead of 0
|
| 790 |
+
df.index = range(1, len(df) + 1)
|
| 791 |
+
|
| 792 |
# Convert amount fields to numeric
|
| 793 |
amount_fields = ['Invoice_amount_FCY', 'Amount_paid_for_each_invoice',
|
| 794 |
'Outstanding_balance_FCY', 'Discounts_taken_FCY',
|
|
|
|
| 820 |
hide_index=False
|
| 821 |
)
|
| 822 |
|
| 823 |
+
# Convert back to string and reset index to 0-based for storage
|
| 824 |
+
edited_df.index = range(len(edited_df))
|
| 825 |
for field in amount_fields:
|
| 826 |
if field in edited_df.columns:
|
| 827 |
edited_df[field] = edited_df[field].apply(lambda x: str(x) if pd.notna(x) else '')
|