03-27-2022, 04:07 AM
Python os.walk() – A Simple Illustrated Guide
According to the Python version 3.10.3 official doc, the module provides built-in miscellaneous operating system interfaces. We can achieve many operating system dependent functionalities through it. One of the functionalities is to generate the file names in a directory tree through .
If it sounds great to you, please continue reading, and you will fully understand os.walk through Python code snippets and vivid visualization.
In this article, I will first introduce the usage of and then address three top questions about , including passing a file’s filepath to , vs. , and recursive.
How to Use os.walk and the topdown Parameter?
Syntax
Here is the syntax for:
![[Image: fOktz0IKYE27u2A2pR5erisdxrh9IVnuRFquolz6...NAj3HUgiOp]](https://lh6.googleusercontent.com/fOktz0IKYE27u2A2pR5erisdxrh9IVnuRFquolz6k4FQSuBIV5Q9kN5mskJT8ICqATNhi59SqpJpOb629v9Nnu2yTB2wVOWUAsbT6x-tp9eCR8YPUIy2YtcqNjCerNNAj3HUgiOp)
Input
1. Must-have parameters:
2. Optional parameters:
Tip: Generally, you only need to use the first two parameters in bold format.
Output
Yields 3-tuples (dirpath, dirnames, filenames) for each directory in the tree rooted at directory top (including top itself).
Example
I think the best way to comprehend is walking through an example.
Our example directory tree and its labels are:
![[Image: RU-gX4CYwtmG96UTi_Ex0nA2CILb1a48aRda8sba...6AY-if_XM-]](https://lh4.googleusercontent.com/RU-gX4CYwtmG96UTi_Ex0nA2CILb1a48aRda8sbayxWSVg0GnVrbUGFpOoJyL2NwkjgjQjRRMDk_DMW8PMLf20FBAYfq6NCi_Js-FPAA1EkwPW5442O78oGNaTvqQk6AY-if_XM-)
By the way, the difference between a directory and a file is that a directory can contains many files like the above directory D contains and .
Back to our example, our goal is to
To use the method, we need to first import module:
![[Image: 8eEm16wd6EFfpJPZ9WAF_uF_wzfFTtbmDhpZn2MQ...fUQun2BGnu]](https://lh6.googleusercontent.com/8eEm16wd6EFfpJPZ9WAF_uF_wzfFTtbmDhpZn2MQVLg8lnN8K9wPQirXIK0qrjKmEULn9TRj6seW90skeLmTZb-isx9YsfItdPng5C2n05Xv5bWmJtSWuSecU6MMjyfUQun2BGnu)
Then we can pass the input parameters to the and generate filenames. The code snippet is:
![[Image: k3nva1QZzCfunGoLdjSuye6EqvOwv8tZ_W5lLrxE...sljeoErm_c]](https://lh6.googleusercontent.com/k3nva1QZzCfunGoLdjSuye6EqvOwv8tZ_W5lLrxEHMegRgTzPVyOmDuRg1L9dLUCf2AFoqc46WRg-sDuNUPnU6OXOAVqncRL4wgGJG00qgOqch6cr7ptnxsgZAsctJsljeoErm_c)
The above code has a function to use along with a for loop. This is the most often usage of so that you can get every file level and filenames from the root directory iteratively.
For those with advanced knowledge in Python’s generator, you would probably have already figured out that actually gives you a generator to yield next and next and next 3-tuple……
Back in this code, we set a flag for the argument. Visually, the topdown search way is like the orange arrow in the picture below:
![[Image: FUigmU9wamX-jo4ONI50A_6-licIWn7CMrmJ4X60...C1TyIutfK_]](https://lh3.googleusercontent.com/FUigmU9wamX-jo4ONI50A_6-licIWn7CMrmJ4X60kp75q_XfqucUm0o2kD8XbKBkKiJH-5APk03_rjhmMx8sC-6JBiNrUUdF-g_UWCZHPCZvqa4MteUauBIW_2cozcC1TyIutfK_)
And if we run the above code, we can the below result:
![[Image: Nw-hjhSoa1DUojcYmZ8Z7fBVB5kSpZ_5j3UCUbAx...kF-PJ1yIC-]](https://lh3.googleusercontent.com/Nw-hjhSoa1DUojcYmZ8Z7fBVB5kSpZ_5j3UCUbAx7OvO20MooQrtWJSn9F3A2KCMow-DtmhRgrySMYW3JW0ePhZGU_xToQoNiGNMQrcXyYr-8_uL-fTf8ZKSnPs-SZkF-PJ1yIC-)
If we set the topdown to be, we are walking the directory tree from its bottom directory D like this:
![[Image: 6npy_jaH9M5LFze668IIkmpGvw8KnloD9Z0y6BFr...rpJ9wYC63I]](https://lh5.googleusercontent.com/6npy_jaH9M5LFze668IIkmpGvw8KnloD9Z0y6BFrIuk9mq9tzKLQu_HpPCv8ObQsfr8GEwcGoXovruJ-3yV4Bd1XwjLyJagTyIV4ApTQah9spOwuoLxDCZ7oNdoDXgrpJ9wYC63I)
The corresponding code snippet is:
![[Image: UX_xHkW0YGkMhQugMEUd84GcqOCF9G-egBHx34R4...TiBGYEyxAL]](https://lh3.googleusercontent.com/UX_xHkW0YGkMhQugMEUd84GcqOCF9G-egBHx34R4lYLSXZ30VxcW8YgiWbpYafXfO7JsE1TaWskGPulzShfH3kyLYmnCAI4auYGulY8perE_1LJmhTP4byBj24n6OSTiBGYEyxAL)
And if we run the above code, we can the below result:
![[Image: Wl58daoFZum7nTYG0iygDw6m8Hy4anHBD63i3vw2...2klPgsmfYK]](https://lh4.googleusercontent.com/Wl58daoFZum7nTYG0iygDw6m8Hy4anHBD63i3vw2I4hH2SSkiBAm80U1qzNVWyPPCBxhxtYlGGw0aXHwRxANh_W02inT3Rky9E7WvkNtEuVDcWTBwW5Viyo2g_zXWf2klPgsmfYK)
Now, I hope you understand how to use and the difference between and . ![[Image: 1f642.png]](https://s.w.org/images/core/emoji/13.1.0/72x72/1f642.png)
Here’s the full code for this example:
How to Pass a File’s filepath to os.walk?
Of course, you might wonder what will happen if we pass a file’s filepath, maybe a Python module filepath string like to the function.
This is exactly a point I was thinking when I started using this method. The simple answer is that it will not execute your codes under the for loop.
For example, if you run a code in our like this:
![[Image: vMK_nlz-ns8zdF5n5OYSk-8l1gPUmYfLx1xQIa40...Is_hTQQYeM]](https://lh4.googleusercontent.com/vMK_nlz-ns8zdF5n5OYSk-8l1gPUmYfLx1xQIa40eNtcuIsMkzGFJLmw4mfLIBxUkpQdjWtqgfap258Oz2AScJFo2oGzXKW-EyvrKyFknZhs2lf3uw-NzB0aMCnt2xIs_hTQQYeM)
The only output would be like this:
![[Image: WnJPLIJ97Z4SuO1W9z7BVkj0MsMc9G3z9JqRGgbS...TLpA4aaer5]](https://lh4.googleusercontent.com/WnJPLIJ97Z4SuO1W9z7BVkj0MsMc9G3z9JqRGgbSZ_v5pnCK-4IOH6Hw_xhoiPNbuuUihrf7yhOFqTwOa1bSsRoFPZ_JH9-on-3AP3G6EspIfMHhw1kkC_whqnif9HTLpA4aaer5)
Why is that?
Because there are neither subdirnames nor subfilenames in a single file! It is like you are writing the below code:
![[Image: cYsMXquGBpvFT-sjlCmlM2l2krJlae7R-tKnuvzC...Bdn7TAuEZB]](https://lh6.googleusercontent.com/cYsMXquGBpvFT-sjlCmlM2l2krJlae7R-tKnuvzCjfqxDPppk5hYViyNPlWvgXOHzLVVUON2M84lcFN7-6s-MQWLzfURiZas2yuwOkbRRox3g7YwET3OUAgfsxrSOwBdn7TAuEZB)
And you will not get any output because there is no element in an empty list.
Now, I hope you understand why the official doc tells us to pass a path to a directory instead of a file’s filepath![[Image: 1f642.png]](https://s.w.org/images/core/emoji/13.1.0/72x72/1f642.png)
os.walk vs os.listdir — When to Use Each?
A top question of programmers concerns the difference between vs .
The simple answer is:
The method returns a list of every file and folder in a directory. The method returns a list of every file in an entire file tree.
![[Image: BC9Egy0ipAEJQuQdwZuGUTcwK7PcDp8jap_ozfpq...EvxwpdiThT]](https://lh6.googleusercontent.com/BC9Egy0ipAEJQuQdwZuGUTcwK7PcDp8jap_ozfpq6EL60-O2sfdB2HELJxvbzh-wBSD-cJK0QL738jlN8Ap2ZEEdgjGt4jxPsKa3J7aHoT-VsgMgpSO49P14XSCG8pEvxwpdiThT)
Well, if you feel a little bit uncertain, we can then use code examples to help us understand better!
We will stick to our same example directory tree as below:
![[Image: RU-gX4CYwtmG96UTi_Ex0nA2CILb1a48aRda8sba...6AY-if_XM-]](https://lh4.googleusercontent.com/RU-gX4CYwtmG96UTi_Ex0nA2CILb1a48aRda8sbayxWSVg0GnVrbUGFpOoJyL2NwkjgjQjRRMDk_DMW8PMLf20FBAYfq6NCi_Js-FPAA1EkwPW5442O78oGNaTvqQk6AY-if_XM-)
In this case, if we call method and pass the directory path of to it like the code below:
![[Image: apX569Vd-f2mJtiwLkn4KZ_5o5lbvbYgr-NsFD55...l96_b6OoXZ]](https://lh3.googleusercontent.com/apX569Vd-f2mJtiwLkn4KZ_5o5lbvbYgr-NsFD55QMDcheCSGP-T4kH89NP-AZzM1BXZ9-6YjvCeaicx_SD2Ro3x_OqkpdlTEWrDqw9yxSXy3cpSZZwrGrBHsOcrT_l96_b6OoXZ)
And we will get an output like:
![[Image: PVpb-AJH8hABEYiEQZSDPks7Iy51KA5X9PGsV6Ix...d4IBoj1mww]](https://lh3.googleusercontent.com/PVpb-AJH8hABEYiEQZSDPks7Iy51KA5X9PGsV6Ix7twt1EL6SGyp9-6mKOC1qqahWNB0s7aZPK_ashhpX4gL9C8i6g2DpjkAwhTlbNSqmuOwTLGyWgxgR1TuitJvJ4d4IBoj1mww)
That’s it! Only the first layer of this entire directory tree is included. Or I should say that the cares only about what is directly in the root directory instead of searching through the entire directory tree like we see before in the example.
Summary
Summary: If you want to get a list of all filenames and directory names within a root directory, go with the method. If you want to iterate over an entire directory tree, you should consider method.
Now, I hope you understand when to use and when to use ![[Image: 1f642.png]](https://s.w.org/images/core/emoji/13.1.0/72x72/1f642.png)
os.walk() Recursive — How to traverse a Directory Tree?
Our last question with is about how to literally iterate over the entire directory tree.
Concretely, we have some small goals for our next example:
All examples below are still based on our old friend, the example directory tree:
![[Image: RU-gX4CYwtmG96UTi_Ex0nA2CILb1a48aRda8sba...6AY-if_XM-]](https://lh4.googleusercontent.com/RU-gX4CYwtmG96UTi_Ex0nA2CILb1a48aRda8sbayxWSVg0GnVrbUGFpOoJyL2NwkjgjQjRRMDk_DMW8PMLf20FBAYfq6NCi_Js-FPAA1EkwPW5442O78oGNaTvqQk6AY-if_XM-)
Iterate over all files within a directory tree
First, let’s head over iterating over all files within a directory tree. This can be achieved by a nested loop in Python.
The potential application could be some sanity checks or number counts for all files within one folder. How about counting the number of files within one folder? Let’s do it!
The code for this application is:
![[Image: lqr4wjEItFHP4H9oot4cePf3kEk747skshJupXlG...anLJCEvzgY]](https://lh4.googleusercontent.com/lqr4wjEItFHP4H9oot4cePf3kEk747skshJupXlG2A-MJnX9HxAtSs56m-n5dgtoZvggQh8KKIAFF5Uj8OOssJbxIHN_PSMklx4hV9GxvWKOrrBGiOJBS7dDKZUl5hanLJCEvzgY)
As you can see, we use another loop to iterate over subfilenames to get evey file within a directory tree. The output is and is correct according to our example directory tree.
The full code for this example can be found here.
Iterate over all directories within a directory tree
Last, we can also iterate over all directories within a directory tree. This can be achieved by a nested for loop in Python.
The potential application could be also be some sanity checks or number counts for all directories within one folder. For our example, let’s check if all directories contains file and add an empty file if not.
Idea: The file signifies whether the entire directory is a Python package or not.
The code for this application is:
![[Image: OciDbIUlpkWjiu56KMYYf4uOZJ1wQxlidMyMix3o...rcU1fa-qIr]](https://lh6.googleusercontent.com/OciDbIUlpkWjiu56KMYYf4uOZJ1wQxlidMyMix3oZx4zRHan0Nw4DJvVWXrJNJnq8vWMraLvoyGiB1zuiGZA9mVNipsJz6ciOUgV3I415p2TehqEnieNxLzk4nYxIrrcU1fa-qIr)
As you can see, we use another loop to iterate over to get evey directory within a directory tree.
Before the execution, our directory tree under the function mentioned before looks like this:
![[Image: Nw-hjhSoa1DUojcYmZ8Z7fBVB5kSpZ_5j3UCUbAx...kF-PJ1yIC-]](https://lh3.googleusercontent.com/Nw-hjhSoa1DUojcYmZ8Z7fBVB5kSpZ_5j3UCUbAx7OvO20MooQrtWJSn9F3A2KCMow-DtmhRgrySMYW3JW0ePhZGU_xToQoNiGNMQrcXyYr-8_uL-fTf8ZKSnPs-SZkF-PJ1yIC-)
After the execution, we can take a walk along the directory tree again and we get result like:
![[Image: NXiGZRZyez7cSSCdeNu_XiITJln-vv8OuxI-o3aE...eqc5WmHSCz]](https://lh4.googleusercontent.com/NXiGZRZyez7cSSCdeNu_XiITJln-vv8OuxI-o3aE8BEoWSeTk6XzW_Ebdz-jsL7YJ5LcLwwabF1TDceDaErItXB1xiccN3NSkFz4A3CtD_vZ7A48mv20FKoVnBwhx8eqc5WmHSCz)
Hooray! We successfully iterate every directory within a directory tree and complete the sanity check.
The full code for this example can be found here.
In summary, you can use recursively traverse every file or directory within a directory tree through a nested for loop.
Conclusion
That’s it for our article!
We learned about its syntax, IO relationship, and difference between and .
We also worked on real usage examples, ranging from changing the search direction through topdown parameter, file number count, and sanity check.
Hope you enjoy all this and happy coding!
About the Author
Anqi Wu is an aspiring Data Scientist and self-employed Technical Consultant. She is an incoming student for a Master’s program in Data Science and builds her technical consultant profile on Upwork.
Anqi is passionate about machine learning, statistics, data mining, programming, and many other data science related fields. During her undergraduate years, she has proven her expertise, including multiple winning and top placements in mathematical modeling contests. She loves supporting and enabling data-driven decision-making, developing data services, and teaching.
Here is a link to the author’s personal website: https://www.anqiwu.one/. She uploads data science blogs weekly there to document her data science learning and practicing for the past week, along with some best learning resources and inspirational thoughts.
Hope you enjoy this article! Cheers!
According to the Python version 3.10.3 official doc, the
Code:
osCode:
os.walk()If it sounds great to you, please continue reading, and you will fully understand os.walk through Python code snippets and vivid visualization.
In this article, I will first introduce the usage of
Code:
os.walkCode:
os.walkCode:
os.walkCode:
os.walkCode:
os.listdirCode:
os.walkHow to Use os.walk and the topdown Parameter?
Syntax
Here is the syntax for
Code:
os.walkCode:
os.walk(top[, topdown=True[, onerror=None[, followlinks=False]]])Input
1. Must-have parameters:
- : accepts a directory(or file) path string that you want to use as the root to generate filenames.Code:
top
2. Optional parameters:
- : accepts a boolean value,Code:
topdown. IfCode:default=Trueor not specified, directories are scanned from top-down. Otherwise, directories are scanned from the bottom-up. If you are still confused about thisCode:Trueparameter like I first get to knowCode:topdown, I have a nicely visualization in the example below.Code:os.walk
- : accepts a function with one argument,Code:
onerror. It can report the error to continue with the walk, or raise the exception to abort the walk.Code:default=None
- : accepts a boolean value,Code:
followlinks. IfCode:default=False, we visit directories pointed to by symlinks, on systems that support them.Code:True
Tip: Generally, you only need to use the first two parameters in bold format.Output
Yields 3-tuples (dirpath, dirnames, filenames) for each directory in the tree rooted at directory top (including top itself).
Example
I think the best way to comprehend
Code:
os.walkOur example directory tree and its labels are:
By the way, the difference between a directory and a file is that a directory can contains many files like the above directory D contains
Code:
4.txtCode:
5.txtBack to our example, our goal is to
- Generate filenames based on the root directory, Code:
learn_os_walk
- Understand the difference between andCode:
topdown=TrueCode:topdown=False
To use the
Code:
os.walk()Code:
osCode:
import osThen we can pass the input parameters to the
Code:
os.walkCode:
a_directory_path = './learn_os_walk' def take_a_walk(fp, topdown_flag=True): print(f'\ntopdown_flag:{topdown_flag}\n') for pathname, subdirnames, subfilenames in os.walk(fp, topdown=topdown_flag): print(pathname) print(subdirnames) print(subfilenames) print('--------------------------------') print('What a walk!') # *Try to walk in a directory path
take_a_walk(a_directory_path)
# Output more than Just 'What a walk!'
# Also all the subdirnames and subfilenames in each file tree level.
# BTW if you want to look through all files in a directory, you can add
# another for subfilename in subfilenames loop inside.The above code has a function
Code:
take_a_walkCode:
os.walkCode:
os.walkFor those with advanced knowledge in Python’s generator, you would probably have already figured out that
Code:
os.walkBack in this code, we set a
Code:
TrueCode:
topdownAnd if we run the above code, we can the below result:
If we set the topdown to be
Code:
FalseThe corresponding code snippet is:
Code:
a_directory_path = './learn_os_walk' def take_a_walk(fp, topdown_flag=False): print(f'\ntopdown_flag:{topdown_flag}\n') for pathname, subdirnames, subfilenames in os.walk(fp, topdown=topdown_flag): print(pathname) print(subdirnames) print(subfilenames) print('--------------------------------') print('What a walk!') # *Try to walk in a directory path
take_a_walk(a_directory_path)
# Output more than Just 'What a walk!'
# Also all the subdirnames and subfilenames in each file tree level.
# BTW if you want to look through all files in a directory, you can add
# another for subfilename in subfilenames loop inside.And if we run the above code, we can the below result:
Now, I hope you understand how to use
Code:
os.walkCode:
topdown=TrueCode:
topdown=False![[Image: 1f642.png]](https://s.w.org/images/core/emoji/13.1.0/72x72/1f642.png)
Here’s the full code for this example:
Code:
__author__ = 'Anqi Wu' import os a_directory_path = './learn_os_walk'
a_file_path = './learn_os_walk.py' # same as a_file_path = __file__ def take_a_walk(fp, topdown_flag=True): print(f'\ntopdown_flag:{topdown_flag}\n') for pathname, subdirnames, subfilenames in os.walk(fp, topdown=topdown_flag): print(pathname) print(subdirnames) print(subfilenames) print('--------------------------------') print('What a walk!') # *Try to walk in a file path
take_a_walk(a_file_path)
# Output Just 'What a walk!'
# Because there are neither subdirnames nor subfilenames in a single file !
# It is like:
# for i in []:
# print('hi!') # We are not going to execute this line. # *Try to walk in a directory path
take_a_walk(a_directory_path)
# Output more than Just 'What a walk!'
# Also all the subdirnames and subfilenames in each file tree level.
# BTW if you want to look through all files in a directory, you can add
# another for subfilename in subfilenames loop inside. # *Try to list all files and directories in a directory path
print('\n')
print(os.listdir(a_directory_path))
print('\n')Of course, you might wonder what will happen if we pass a file’s filepath, maybe a Python module filepath string like
Code:
'./learn_os_walk.py'Code:
os.walkThis is exactly a point I was thinking when I started using this method. The simple answer is that it will not execute your codes under the for loop.
For example, if you run a code in our
Code:
learn_os_walk.pyCode:
import os a_file_path = './learn_os_walk.py' # same as a_file_path = __file__ def take_a_walk(fp, topdown_flag=False): print(f'\ntopdown_flag:{topdown_flag}\n') for pathname, subdirnames, subfilenames in os.walk(fp, topdown=topdown_flag): print(pathname) print(subdirnames) print(subfilenames) print('--------------------------------') print('What a walk!') # *Try to walk in a file path
take_a_walk(a_file_path)The only output would be like this:
Why is that?
Because there are neither subdirnames nor subfilenames in a single file! It is like you are writing the below code:
Code:
for i in []: print('hi!')And you will not get any
Code:
'hi'Now, I hope you understand why the official doc tells us to pass a path to a directory instead of a file’s filepath
![[Image: 1f642.png]](https://s.w.org/images/core/emoji/13.1.0/72x72/1f642.png)
os.walk vs os.listdir — When to Use Each?
A top question of programmers concerns the difference between
Code:
os.walkCode:
os.listdirThe simple answer is:
The
Code:
os.listdir()Code:
os.walk()Well, if you feel a little bit uncertain, we can then use code examples to help us understand better!
We will stick to our same example directory tree as below:
In this case, if we call
Code:
os.listdir()Code:
learn_os_walkCode:
import os a_directory_path = './learn_os_walk' # *Try to list all files and directories in a directory path
print('\n')
print(os.listdir(a_directory_path))
print('\n')And we will get an output like:
That’s it! Only the first layer of this entire directory tree is included. Or I should say that the
Code:
os.listdir()Code:
os.walkSummary
Summary: If you want to get a list of all filenames and directory names within a root directory, go with the
Code:
os.listdir()Code:
os.walk()Now, I hope you understand when to use
Code:
os.listdirCode:
os.walk![[Image: 1f642.png]](https://s.w.org/images/core/emoji/13.1.0/72x72/1f642.png)
os.walk() Recursive — How to traverse a Directory Tree?
Our last question with
Code:
os.walkConcretely, we have some small goals for our next example:
- Iterate over all files within a directory tree
- Iterate over all directories within a directory tree
All examples below are still based on our old friend, the example directory tree:
Iterate over all files within a directory tree
First, let’s head over iterating over all files within a directory tree. This can be achieved by a nested
Code:
forThe potential application could be some sanity checks or number counts for all files within one folder. How about counting the number of
Code:
.txtThe code for this application is:
Code:
import os a_directory_path = './learn_os_walk'
total_file = 0 for pathname, subdirnames, subfilenames in os.walk(a_directory_path): for subfilename in subfilenames: if subfilename.endswith('.txt'): total_file += 1
print(f'\n{total_file}\n')As you can see, we use another
Code:
forCode:
7The full code for this example can be found here.
Iterate over all directories within a directory tree
Last, we can also iterate over all directories within a directory tree. This can be achieved by a nested for loop in Python.
The potential application could be also be some sanity checks or number counts for all directories within one folder. For our example, let’s check if all directories contains
Code:
__init__.pyCode:
__init__.py
Idea: The Code:
__init__.pyThe code for this application is:
Code:
import os a_directory_path = './learn_os_walk' for pathname, subdirnames, subfilenames in os.walk(a_directory_path): for subdirname in subdirnames: init_filepath = os.path.join(pathname, subdirname, '__init__.py') if not os.path.exists(init_filepath): print(f'Create a new empty [{init_filepath}] file.') with open(init_filepath, 'w') as f: passAs you can see, we use another
Code:
forCode:
subdirnamesBefore the execution, our directory tree under the
Code:
take_a_walkAfter the execution, we can take a walk along the directory tree again and we get result like:
Hooray! We successfully iterate every directory within a directory tree and complete the
Code:
__init__.pyThe full code for this example can be found here.
In summary, you can use
Code:
os.walkConclusion
That’s it for our
Code:
os.walk()We learned about its syntax, IO relationship, and difference between
Code:
os.walkCode:
os.listdirWe also worked on real usage examples, ranging from changing the search direction through topdown parameter,
Code:
.txtCode:
__init__.pyHope you enjoy all this and happy coding!
About the Author
Anqi Wu is an aspiring Data Scientist and self-employed Technical Consultant. She is an incoming student for a Master’s program in Data Science and builds her technical consultant profile on Upwork.
Anqi is passionate about machine learning, statistics, data mining, programming, and many other data science related fields. During her undergraduate years, she has proven her expertise, including multiple winning and top placements in mathematical modeling contests. She loves supporting and enabling data-driven decision-making, developing data services, and teaching.
Here is a link to the author’s personal website: https://www.anqiwu.one/. She uploads data science blogs weekly there to document her data science learning and practicing for the past week, along with some best learning resources and inspirational thoughts.
Hope you enjoy this article! Cheers!

