Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,209,168 members, 8,005,177 topics. Date: Sunday, 17 November 2024 at 04:14 PM |
Nairaland Forum / Science/Technology / Programming / Python For Accountants (2173 Views)
A 30 Day Coding Challenge (Python) For BEGINNERS / Python for Non-Technical people / Who's Interested In Learning Python For Data Science (from Scratch) (2) (3) (4)
Python For Accountants by SKYQUEST(m): 12:31pm On Apr 12, 2020 |
I am a Chartered Accountant with over 12 years working experience across the banking, engineering and education niches. Somehow, I picked interest in programming with a view to expanding on my skills. I initially started with Java en route to Hadoop and Apache spark because of my interest in big data analytics. I must say that Java is a great programming language to play with, I was in love with it while studying it. However, I soon switched over to learning Python because of its more relevance to data science and its applicability to various domain of accounting such as finance, auditing, accounting, taxation and system accounting. I like to begin an expository journey with fellow accountants who may be showing interest in programming. Hopefully, I will get to receive inputs from programmers who may have one or two modifications to make on my presentations. Lets play! 4 Likes |
Re: Python For Accountants by Playforkeeps(m): 6:26pm On Apr 12, 2020 |
Hey OP, 12 years is a lot of expertise to have specialization in, I myself am a graduate of Finance, so I’ve always been curious about the possibilities of implementing Python in Business as a whole. I may be wrong but I’m starting to believe that Python might be an overkill for most accounting tasks as there are other data analysis solutions that work better than Python at things like that and are just as intuitive. Of course that doesn’t mean that there are no uses, just very few right now, as the field of machine learning hasn’t even peaked yet, although it’s not a young field of specialization. One of Python’s main marketing points is how perfect it is for AI because of its host of packages and libraries (scikit-learn, Keras, Tensorflow, etc) you can select from. Most Python AI libraries can perform Machine learning tasks, some of these Machine Learning tasks can help optimize an accounting process by doing either of the following ; Classification of data with similar features or inputs Making accurate predictions from historic data, although other tools exist for this task and are easier to implement And auditing too. I’m sure there are a lot of other creative ways people mix accounting and programming, I just think it’s early now to find a defining project that does it 1 Like |
Re: Python For Accountants by SKYQUEST(m): 12:53am On Apr 15, 2020 |
Let us touch on few basic fundamentals of Python Programming: Data Types in Python Data types determine what kind of operation can be performed on a data. They are either numeric, non-numeric or Boolean. In python data types can be: 1. Numeric where they are either integer, float or complex numbers, 2. Boolean which takes True or False values, 3. Sequence type which is ordered collection of similar or different data types. Built- in sequence data types in Python are String, List and Tuples, 4. Dictionary which is an unordered collection of data in a key value pair form. To ascertain the data type of a value you are working with, a python in-built function, type() can be used. For example: >>> type(8033445566) >>>int >>>type(“CEO”) >>>str If you are working with a dataframe, to find the data type i.e. dtype of a column, DataFrame.dtype is used instead. Notably, objects created from any of the data types can either be mutable or immutable. They are immutable if after creation on the computer memory, they cannot be modified. If they can be altered they are otherwise known as mutable. Items in a list or dictionary for example can be deleted, added to or rearranged. Hence, list and dictionary are mutable. The content of number values, strings and tuples cannot be altered and are therefore immutable. 1 Like |
Re: Python For Accountants by SKYQUEST(m): 12:58am On Apr 15, 2020 |
Playforkeeps: Your valid points are areas of concern |
Re: Python For Accountants by Playforkeeps(m): 7:46am On Apr 15, 2020 |
// |
Re: Python For Accountants by SKYQUEST(m): 10:21pm On Apr 16, 2020 |
String Operators In python, operators such as floor divisions (//), exponent(**), division(/) and modulus (%) are not used with strings. Addition (+) and multiplication (*) are however used. [] operator returns the character at a given index in a sequence: >>>Branch = “ Enugu” >>>Branch[1] = “n” >>>Branch[2] =”u” [:] operator fetches the characters in the range specified by the two operands as separated by the : symbol >>>Reprimand = “caution from hr dept” >>>Reprimand [12:15] >>>”hr” Note that the white space in the string Reprimand object is also at their individual index positions. in operator returns true if a required character exist in a string while the contrast not in operator returns true if a character does not exist in a string and vice versa. |
Re: Python For Accountants by afuye(m): 10:51am On Apr 17, 2020 |
I'm a Chartered accountant with 12years experience but now a full time software engineer. Area of specialization is JavaScripts for web and mobile development |
Re: Python For Accountants by SKYQUEST(m): 12:02pm On Apr 17, 2020 |
afuye: What has the experience being like as a software engineer and what triggered the choice for a career change? |
Re: Python For Accountants by SKYQUEST(m): 12:22pm On Apr 17, 2020 |
Strings Concatenation Merging or combining two or more string together to form a new string object is called string concatenation. This is done with the use of the operator “+”. >>>String1 = “Balance” >>>String2 = “Sheet” >>>String1 + String2 >>>”BalanceSheet” Or better still….. >>>String1 = “Balance” >>>String3 = “ “ >>>String2 = “Sheet” >>>String1 + String3 + String2 >>>”Balance Sheet” Mind you, if you concatenate string “23” and string “34” as in: >>>add1 = “23” >>>add2 =”34” # what you will have is >>>”2334” As against: >>>add1 = 23 >>>add2 = 34 >>> add1+add2 # which output >>>57 While “23” and “34” are string values, 23 and 34 are integers. |
Re: Python For Accountants by afuye(m): 3:33pm On Apr 17, 2020 |
SKYQUEST: It has afforded me opportunity to work at my convenience with flexibility. I love building and seeing things and there is opportunity to build personal projects as well. Since I left last year, no regrets 1 Like |
Re: Python For Accountants by africanman85: 3:39pm On Apr 17, 2020 |
afuye:What programming languages do I need to learn to be a software engineer ? Which one do I start first ? |
Re: Python For Accountants by SKYQUEST(m): 11:19pm On Apr 17, 2020 |
afuye: It's great doing the things you love! |
Re: Python For Accountants by afuye(m): 1:47am On Apr 18, 2020 |
africanman85: It depends on what you intend to build. I use JavaScript with react-native, reactjs and nodejs which I use for mobile,web and server side respectively. There are other sides apart from web development. Do your research to learn more. Talk to me with the number below Find what u think u love. Then give it a shot. 1 Like |
Re: Python For Accountants by SKYQUEST(m): 3:55pm On Apr 18, 2020 |
str () function This python built-in function returns a printable string representation of any object. It is able to convert any specified integer, float data type or generally any python data object into string object. For example, >>>print (“Total accounts opened by Operation Department is “ +10) This results in TypeError: can only concatenate str (not “int”) to str; “Total accounts opened by Operation Department is “ is a string; 10 is an int data type. By converting the number value 10 to string using the str() function enables the concatenation of string to string: >>>print (“Total accounts opened by Operation Department is “ + str(10)) >>> “Total accounts opened by Operation Department is 10” |
Re: Python For Accountants by SKYQUEST(m): 10:14pm On Apr 26, 2020 |
String Formatting String formatting involves the interpolation of objects inside a string. The interpolation is done using a placeholder placed within the string. The placeholder can be named indexes {cost}, numbered indexes {1} or empty curly braces placed within the string { }. String formatting can be done either through the use of: • % operator ( the arithmetic operator used in returning the remainder of division) • The format() method using the syntax: string.format(str1, str2, str3,….) Using the % format operator: Example1, >>> name = “Segun Oketade” >>>”The name of our branch manager is %s” %name “The name of our branch manager is Segun oketade” In the example above, the left side of the expression holds the format string while the right hand side holds a collection of values that will be substituted into the format string. The format string contains one or more conversion characters which tell the format operator what type of value should be inserted into the specified position in the string. Possible type specification include d, i (integers), f, e (floats), c (single character) etc Example2: >>> direction= “increment” >>> rate = 30 >>>”The %s in profit expected of the company was %d percent every year. Even if the %d was at a rate higher than %d percent, it would still have surpassed it.” %( direction, rate, direction, rate) ”The increment in profit expected of the company was 30 percent every year. Even if the increment was at a rate higher than 30 percent, it would still have surpassed it.” In the example above, there were four arguments in the tuple because there were four place holders for the format string. |
Re: Python For Accountants by hardeycute(m): 10:58am On Apr 28, 2020 |
OP I'm confused with your code lines so far BTW I'm interested in data analysis, I just learned basic excel with plans to learn advanced excel and python, any other programming language I should learn? |
Re: Python For Accountants by SKYQUEST(m): 11:09pm On Apr 28, 2020 |
hardeycute: what is the specific area of confusion? on your interest in data analysis, start with python and ice it with tableau or powerbi and sql; your knowledge of excel is an added advantage |
Re: Python For Accountants by SKYQUEST(m): 11:14pm On Apr 28, 2020 |
String formatting Using the % format operator: Example1, >>> name = “Segun Oketade” >>>”The name of our branch manager is %s” %name “The name of our branch manager is Segun oketade” In the example above, the left side of the expression holds the format string while the right hand side holds a collection of values that will be substituted into the format string. The format string contains one or more conversion characters which tell the format operator what type of value should be inserted into the specified position in the string. Possible type specification include d, i (integers), f, e (floats), c (single character) etc Example2: >>> direction= “increment” >>> rate = 30 >>>”The %s in profit expected of the company was %d percent every year. Even if the %d was at a rate higher than %d percent, it would still have surpassed it.” %( direction, rate, direction, rate) ”The increment in profit expected of the company was 30 percent every year. Even if the increment was at a rate higher than 30 percent, it would still have surpassed it.” In the example above, there were four arguments in the tuple because there were four place holders for the format string. Using the format() method: The format() allow the use of simple placeholders for basic formatting. Example1, using default arguments (i.e. empty placeholders): >>>“Dear Mr. {}, your account balance is N{}”.format(“James”, 42000) “Dear Mr. James, your account balance is N42000” Example2, using positional arguments (i.e. index number of the arguments in the tuple) >>>“Dear Mr. {0}, your account balance is N{1}”.format(“James”, 42000) “Dear Mr. James, your account balance is N42000” Example 3, using keyword arguments (i.e. named indexes) >>>“Dear Mr. {firstname}, your account balance is N{amount}”.format(firstname= “James”, amount= 42000) “Dear Mr. James, your account balance is N42000” Example 4, using mixed arguments (i.e. mix of positional argument and keyword argument) >>>“Dear Mr. {0}, your account balance is N{amount}”.format(“James”, amount= 42000) “Dear Mr. James, your account balance is N42000” You will notice that the positional argument 0 was declared before the keyword argument amount. What do you think will happen if the declaration of positional argument is made after that of the keyword argument? |
Re: Python For Accountants by SKYQUEST(m): 2:23pm On May 22, 2020 |
I would rather that we start considering practical challenges that we may come across in our various offices. How do we apply some Python syntax to resolve these challenges? |
Re: Python For Accountants by SKYQUEST(m): 3:15pm On May 22, 2020 |
what python code would you run on a table with data separated by spaces as shown in the image below to convert it in into a readable excel table; the raw data is also given in the attachment below:
|
Re: Python For Accountants by SKYQUEST(m): 1:57pm On May 24, 2020 |
If you try to read the file with the read_csv( ) function, an error will be thrown because the file is not a comma seperated values (csv) file. Try run the under listed code on the file: import pandas as pd from pandas import DataFrame df = pd.read_excel('split.xlsx',names=['Benf']) #seperate each of the column elements into different list a = df.Benf.str.split().str[0].tolist() b = df.Benf.str.split().str[1].tolist() c = df.Benf.str.split().str[2].tolist() d = df.Benf.str.split().str[3].tolist() df=pd.DataFrame() #create an empty dataframe df['First Digit']=a #add the first column to the dataframe and name it First Digit df["Benford's Set"]=b df['Data Set X']=c df['Deviations']=d df You will come up with an excel file that looks like this: 1 Like
|
Re: Python For Accountants by SKYQUEST(m): 9:17pm On Jun 10, 2020 |
If you had a table like the one in the attachment (and image below); what python code would you run on the table to generate a dataframe showing accounts that where opened on Sundays and Saturdays?
|
Re: Python For Accountants by SKYQUEST(m): 10:51am On Jun 12, 2020 |
This should do the job: import pandas as pd df = pd.read_excel('AccountOpening.xlsx') df['Weekdays'] = df['Account Opening Date'].dt.strftime('%A') df[(df['Weekdays']=='Saturday')|(df['Weekdays']=='Sunday')] ...and this gives:
|
Re: Python For Accountants by gbolly1151(m): 2:12pm On Jun 12, 2020 |
SKYQUEST:I disagree with you sir,that because the file is not a comma seperated value. The class read_csv(filename,delimiter=' ') will open file separated by space character. |
Re: Python For Accountants by SKYQUEST(m): 1:56pm On Jun 15, 2020 |
gbolly1151: I agree with you on read_csv ( ); kindly run the function on the file (it is still in the attachment above) and lets have your dataFrame output. |
Re: Python For Accountants by gbolly1151(m): 5:15pm On Jun 15, 2020 |
SKYQUEST:I dont get you sir...this is xlsx extension, you cant expect read_csv to open it or maybe i dont understand what you are requesting for |
Re: Python For Accountants by SKYQUEST(m): 9:38pm On Jun 16, 2020 |
gbolly1151:..my bad! This is the csv file here:
|
(1) (Reply)
Website Vs Web Application. The Difference. / How To Install .NET Framework 3.5 In Windows 10 (offline) / Virtualdj 8.5 Mac Serial Number
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 51 |