netflypsb commited on
Commit
b745404
1 Parent(s): 6957522

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +70 -0
app.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+
4
+ # Title and Description
5
+ st.title('Operational Cash Flow Analysis')
6
+ st.write("""
7
+ This application allows you to analyze and visualize your company's operational cash flow.
8
+ """)
9
+
10
+ # Data Input Section
11
+ st.header('Input Financial Data')
12
+
13
+ # Input fields for financial data
14
+ net_income = st.number_input('Net Income', value=0)
15
+ depreciation = st.number_input('Depreciation and Amortization', value=0)
16
+ change_ar = st.number_input('Change in Accounts Receivable', value=0)
17
+ change_inventory = st.number_input('Change in Inventory', value=0)
18
+ change_ap = st.number_input('Change in Accounts Payable', value=0)
19
+
20
+ # Calculating Operational Cash Flow
21
+ ocf = net_income + depreciation - change_ar - change_inventory + change_ap
22
+
23
+ # Displaying the result
24
+ st.subheader('Calculated Operational Cash Flow')
25
+ st.write(f'Operational Cash Flow: ${ocf}')
26
+
27
+ # DataFrame for historical data visualization (example data)
28
+ data = {
29
+ 'Year': ['2020', '2021', '2022'],
30
+ 'Net Income': [100000, 120000, 130000],
31
+ 'Depreciation and Amortization': [20000, 25000, 27000],
32
+ 'Change in AR': [-5000, -6000, -5500],
33
+ 'Change in Inventory': [-8000, -7500, -9000],
34
+ 'Change in AP': [7000, 8500, 9000],
35
+ 'Operational Cash Flow': [114000, 137500, 149500]
36
+ }
37
+ df = pd.DataFrame(data)
38
+
39
+ # Display the historical data table
40
+ st.subheader('Historical Data')
41
+ st.dataframe(df)
42
+
43
+ # Visualize the historical operational cash flow
44
+ st.subheader('Operational Cash Flow Over Years')
45
+ st.line_chart(df[['Year', 'Operational Cash Flow']].set_index('Year'))
46
+
47
+ # Scenario Analysis Section
48
+ st.header('Scenario Analysis')
49
+
50
+ # Interactive widgets for scenario analysis
51
+ new_net_income = st.slider('New Net Income', min_value=0, max_value=200000, value=net_income)
52
+ new_depreciation = st.slider('New Depreciation and Amortization', min_value=0, max_value=50000, value=depreciation)
53
+ new_change_ar = st.slider('New Change in Accounts Receivable', min_value=-10000, max_value=10000, value=change_ar)
54
+ new_change_inventory = st.slider('New Change in Inventory', min_value=-15000, max_value=15000, value=change_inventory)
55
+ new_change_ap = st.slider('New Change in Accounts Payable', min_value=-10000, max_value=10000, value=change_ap)
56
+
57
+ # Recalculate OCF based on new inputs
58
+ new_ocf = new_net_income + new_depreciation - new_change_ar - new_change_inventory + new_change_ap
59
+
60
+ # Display the new result
61
+ st.subheader('Scenario Analysis Result')
62
+ st.write(f'New Operational Cash Flow: ${new_ocf}')
63
+
64
+ # Button to download data as CSV
65
+ st.download_button(
66
+ label="Download Data as CSV",
67
+ data=df.to_csv().encode('utf-8'),
68
+ file_name='operational_cash_flow.csv',
69
+ mime='text/csv',
70
+ )