Python extracts Excel content and splits tables according to needs

Preface

The text and pictures in this article are from the Internet and are for learning and communication purposes only. They do not have any commercial use. If you have any questions, please contact us for processing.

PS: If you need Python learning materials, you can click on the link below to get it yourself

Python free learning materials and group communication answers Click to join


Adhering to the principle of using less mouse, using less mouse, and using more keyboard, using keyboard.

(1) Split the Excel table according to data content requirements

Splitting an Excel table according to data content requirements is an operation that requires frequent use of the mouse. The following content-splitting the Excel table according to work experience requirements is just a simple example.

 

 

Use Excel to process, first arrange the order according to the work experience requirements (years), then create multiple Excel tables (1 year, 3 years, etc.), copy and paste the header information, and then according to the work experience requirements (1 year) , 2 years) in order to copy to the newly created Excel table, click to click with the mouse, it can be done, but it feels more mouse-consuming.

Use Python to process, first read the file, save it with the list to get to the work experience requirements, and then use the program to generate the Excel table of the corresponding year according to the work experience requirements and the original file data information. It does not require much mouse, which can greatly reduce the mouse Loss situation.

Code part:

Obtain file information and work experience requirements

Split data

Test Results:

(2) Extract the data of certain rows and certain columns according to demand

Use the mouse to click on the part that needs to be selected in Excel, and copy and paste operations require a lot of use of the mouse. Simple extraction of some data with Python does not require the use of the mouse, which can greatly reduce the loss of the mouse.

Assumed data information to be extracted

Code part:

Read file

OK

Execution function part

operation result:

Guess you like

Origin blog.csdn.net/pythonxuexi123/article/details/112966765