current position:Home>You can easily get started with Excel. Python data analysis package pandas (3): making score bar
You can easily get started with Excel. Python data analysis package pandas (3): making score bar
2021-08-23 04:47:02 【Excel catalyst】
Series articles :
I often listen to others Python How powerful in the data field , As a result, I studied for a long time , Even data processing is a death of trouble . Only later , It's not Python Data processing is powerful , But he has a data analysis artifact —— pandas
Preface
Many never touched pandas After seeing the relevant information , I think this thing can't handle, like Excel Data in that complex and changeable format . Actually pandas Compared with manual operation 、 PivotTable operations are even Vba operation , It can process complex shape data more flexibly and quickly .
This time, , So let's see how it works pandas Generate various format data such as payslip at one time .
Case study
Continue to use the transcript data :
We want to list each student's transcript separately , That is, a row of records becomes a small table :
Excel skill
use Excel Can the built-in function complete this work in batch ? Certainly. , It just takes a lot of skill . But I always say , Ideas are more important than methods , This is because , If you understand this Excel The operation process , The same idea can be applied to pandas Finish in .
have a look Excel How to accomplish this requirement , We use it 10 A record to demonstrate :
- Add auxiliary sequence , Each value is separated by 2( This is because each row of the resulting data is separated by 2 That's ok )
- Under the auxiliary column , Generating sequences ( The end value is the mantissa of the previous sequence )
- Use Excel The built-in generation series function can
- Batch add header row
- from 3 Start , every other 3 Set a title for the row
- Remove duplicate sequence lines
- Finally, sort according to the auxiliary column , You get the result
pandas practice
pandas There are many ways to implement , This section begins with the above Excel The solution is basically the same way . as follows :
- Modify row index value , amount to Excel The first step
- reindex You can give non-existent row index values , Then those lines will become empty
- amount to Excel The second and fourth steps in
- Last , From the index 3 Start , every other 3 Just assign row and column headings
The complete code is as follows :
Last
The method introduced in this paper has great practical limitations , For example, it cannot be divided according to any dimension , And it requires a user pair pandas Have a deep understanding of the index in . Next time, we will introduce a general way , You can also add summary rows to each small table .
If you want to learn from scratch pandas , Then you can look at my pandas special column .
This article is from WeChat official account. - Excel catalyst (ExcelCuiHuaJi)
The source and reprint of the original text are detailed in the text , If there is any infringement , Please contact the [email protected] Delete .
Original publication time : 2019-08-21
Participation of this paper Tencent cloud media sharing plan , You are welcome to join us , share .
copyright notice
author[Excel catalyst],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2021/08/20210823044659152c.html
The sidebar is recommended
- [Python introduction project] use Python to generate QR code
- Compile D + +, and use d to call C from python
- Quickly build Django blog based on function calculation
- Python collects and monitors system data -- psutil
- Python interface test unittest usage details
- Implementation of top-level design pattern in Python
- You can easily get started with Excel. Python data analysis package pandas (VII): breakdown
- Python simulation random coin toss (non optimized version)
- Python tiktok 5000+ V, and found that everyone love this video.
- Using linear systems in python with scipy.linalg
guess what you like
-
Using linear systems in python with scipy.linalg
-
Together with Python to do a license plate automatic recognition system, fun and practical!
-
You can easily get started with Excel. Python data analysis package pandas (XI): segment matching
-
Using linear systems in python with scipy.linalg
-
Fast power modulus Python implementation of large numbers
-
Quickly build Django blog based on function calculation
-
This paper clarifies the chaotic switching operation and elegant derivation of Python
-
You can easily get started with Excel pandas (I): filtering function
-
You can easily get started with Excel. Python data analysis package pandas (II): advanced filtering (I)
-
You can easily get started with Excel. Python data analysis package pandas (2): advanced filtering (2)
Random recommended
- Test Development: self study Dubbo + Python experience summary and sharing
- How does Python correctly call jar package encryption to get the encrypted value?
- Python 3 interview question: give an array. If there is 0 in the array, add a 0 after 0, and the overall array length remains the same
- Python simple Snake game (single player mode)
- Using linear systems in python with scipy.linalg
- Python executes functions and even code through strings! Come and understand the operation of such a top!
- Decoding the verification code of Taobao slider with Python + selenium, the road of information security
- [Python introduction project] use Python to generate QR code
- Vanessa basks in her photos and gets caught up in the golden python. There are highlights in the accompanying text. She can't forget Kobe after all
- [windows] Python installation pyteseract
- [introduction to Python project] create bar chart animation in Python
- Fundamentals of Python I
- Python series tutorials 116
- Python code reading (chapter 35): fully (deeply) expand nested lists
- Practical series 1 ️⃣ Wechat applet automatic testing practice (with Python source code)
- Python Basics: do you know how to use lists?
- Solution of no Python 3.9 installation was detected when uninstalling Python
- [Python homework] coupling network information dissemination
- [common links of Python & Python]
- [Python development tool tkinterdiesigner]: example: develop stock monitoring alarm using Tkinter desinger
- [Python development tool Tkinter designer]: Lecture 2: introduction to Tkinter designer's example project
- [Python development tool Tkinter designer]: Lecture 1: introduction to the basic functions of Tkinter Designer
- [introduction to Python tutorial] use Python 3 to teach you how to extract any HTML main content
- Python socket implements UDP server and client
- Python socket implements TCP server and client
- [algorithm learning] 1486 Array XOR operation (Java / C / C + + / Python / go / trust)
- leetcode 1974. Minimum Time to Type Word Using Special Typewriter(python)
- The mobile phone uses Python to operate picture files
- [learning notes] Python exception handling try except...
- Two methods of using pandas to read poorly structured excel. You're welcome to take them away
- Python sum (): the summation method of Python
- Practical experience sharing: use pyo3 to build your Python module
- Using Python to realize multitasking process