# 116|PYTHON – K-1 Creation

**URL:** <https://www.techhub.training/t/116-python-k-1-creation/749>\
**Category:** Challenges\
**Tags:** intermediate, tax, python, pandas, partnerships\
**Created:** [June 13, 2023, 4:33pm UTC](https://www.techhub.training/t/116-python-k-1-creation/749 "2023-06-13T16:33:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TylerBooth](https://sea2.discourse-cdn.com/flex016/user_avatar/www.techhub.training/tylerbooth/32/335_2.png) [@TylerBooth](https://www.techhub.training/u/TylerBooth)\
**Post date:** [June 13, 2023, 4:33pm UTC](https://www.techhub.training/t/116-python-k-1-creation/749/1 "2023-06-13T16:33:33Z")

</div>

_BYU Student Author_: @TylerBooth  
_Reviewers_: @Hyrum, @Erick_Sizilio  
_Estimated Time to Solve:_ 60 Minutes

We provide the solution to this challenge using:

- Python

My solution utilizes the Pandas and PyPDF2 packages.

Need a program? Click [here](https://www.techhub.training/t/information-about-software-used-on-techhub-training/138).

**Overview**  
Last year, you graduated with your master’s degree in accounting. This year, you finished your CPA exams and finally became a licensed professional! After becoming an official CPA, you have decided to open your own accounting firm that specializes in partnership tax returns. The only problem is that you dread filling out repetitive IRS forms. You would like to spend less time doing manual data entry and more time advising your clients.

While you were in college, you took a class dedicated to learning Python. You know that a Python script could be a great solution to your data entry problem. However, you don’t remember learning how Python could interact with PDF files. Fortunately, a quick internet search suggested a Python package that may be just what you need! Here is the helpful [webpage](https://pypdf2.readthedocs.io/en/stable/user/forms.html).

To access the PyPDF2 library, run this this line of code: pip install pypdf

**Instructions**  
Using the method suggested on the webpage, create a Python script that will do the following:

1. Read the data from the .xlsx file
2. Open a blank Schedule K-1
3. Fill the Schedule K-1
4. Save the Schedule K-1 as a new file
5. Repeat the steps for every partner

**Data Files**

- [Challenge116\_Data.xlsx](https://byu.box.com/shared/static/uruyl6amawxabitfienxrixqdc7kudcc)
- [Challenge116\_f1065sk1.pdf](https://byu.box.com/shared/static/pfkp0m5lylw5xtdvip39npjaukf45xcv)

Note: The data file contains 14 columns. The first column “Key” contains values that correspond with the PDF fillable fields. The next 13 columns contain the data for each partner.

> **Suggestions and Hints**
>
> You can use pandas to easily read a .xlsx file and store it as a dataframe with this code:
> 
> ```auto
> Import pandas as pd 
> Data = pd.read_excel(‘Insert .xlsx filepath here’) 
> 
> ```

**Solution**

[Challenge116\_Solution.txt](https://byu.box.com/shared/static/mh9o6rre9a6v715i4unlymk294myv0cu)  
_Solution Video:_ [Challenge 116|PYTHON – K-1 Creation](https://youtu.be/3EXiTwpN3Ng)

Special thanks to @Hyrum for helping to create the solution file!
