How to creat an expenses tracking app with python programming
Python programing language,excel, data science and data analysis skill development article.
The below python line of code will creat a daily expenses with date stamp. it will creat and save our expenses into an excel file format called csv. Therefore, we can open this created file with google sheet for analysis e.g.
- Maximun Expenses
- Minimun Expenses
- Average
- Automatic chart for data visualization
To start with, Let us creat our python code using our IDE . If you do not have an IDE. you can download it on goodle as python IDE or use VISUAL studio IDE.
Python code:
#first let us import the all libery needed
#To attach date to our daily expenses,use this:
from datetime import date
#To creat,open,read and update an excel file format(cvs file extension),use this:
import csv
#working with date formating
dt = date.today()
dt = dt.strftime("%d/%m/%y")
#Now,let us creat an csv file call test,csv
filename = "test.csv"
#creat an empty list to store all our expenses
exp = []
#creat a condition to end or continue user input
stopped = False
#open the created file
with open(filename, 'a',newline="") as file:
csvwriter = csv.writer(file)
#creat a while loop to append all the expenses
while not stopped:
xp = int(input("what is your expense price (type 0 to stop):"))
if xp ==0:
stopped = True
else:
#append all the the expenses to the csv file
csvwriter.writerow([dt,xp])
exp.append(xp)
#close the file
file.close()
#print the output
print ("your expenses today are :",exp)
#add the whole expenses
print("your total is :",sum(exp))
#find the maximun and minimun expenses
print("your max is :",max(exp))
print("your min is :",min(exp))
Now, run this lines of code with your python IDE. Then navigate to your file on yor computer, look for the file called test.csv. open it. Then all our expenses will be save with date stamp.
Finally,
- open your browser, navigate to your gmail account
- creat a new google sheet
- upload the test.csv file (it will open as an excel file,well presented as table)
- your can now perform some basic excel function as listed above:
- Maximun Expenses
=Max(B1:B9)
- Minimun Expenses
=Min(B1:B9)
- Average
=Average(B1:B9)
- Automatic chart for data visualization
click on add chart icon for data presentation,visualization and analysis
The sheet will automatic generate any form of data visualization related to your expenses.
e.g pie chart,bar chart,histogram,linear function,total expenses etc.
You can clean up your dashboard to yor satisfaction.
About Me
I am Akinpelu Abiodun Moses by name. I am a programmer and a graphics designer.
Follow my google website link to know more about me:
Popular Post
- Wifi hacking with python
- Complete html,css and javascript web page
- Facebook login and sign up form with html,css and javascript
- Resturant,college,hostital and pharmercy store management system with python
- online shopping website with html,css and javascript
- Text to speech app with html,css and javascript
- Online text editor with html,css and javascript
- Quiz app with html,css and javascript
- To -do app with html,css and javascript
You can contact me for there source code on my website:
Thanks alot, this article is really helpful
ReplyDelete