In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
It is believed that many inexperienced people don't know what to do about how to use pandas to make score strips in Python. Therefore, this paper summarizes the causes and solutions of the problems. Through this article, I hope you can solve this problem.
Excel skills
Can this work be done in batches with Excel's own features? Of course, but it takes a lot of skill. But I always say that ideas are more important than methods, because if you understand the Excel operation process, the same idea can be applied to pandas.
Take a look at how Excel accomplishes this requirement, and we demonstrate it with 10 records:
Add an auxiliary sequence with each value separated by 2 (this is because the resulting data is separated by 2 rows)
Under the secondary column, generate the sequence (the ending value is the Mantissa of the previous sequence)
You can use the build series function that comes with Excel.
Add title rows in batch
Starting at 3, set a title every three lines
Remove duplicate sequence lines
Finally, the result can be obtained by sorting according to the auxiliary column.
Pandas practice
There are many ways to implement pandas. This section first introduces the ways that are basically consistent with the solution of Excel mentioned above. As follows:
Modify the row index value, which is equivalent to the first step of Excel
Reindex can give index values to rows that do not exist, and those rows will become blank lines
Equivalent to the second and fourth steps in Excel
Finally, starting with index 3, you can assign column headings every three rows
The complete code is as follows:
After reading the above, have you mastered how to use pandas to make score strips in Python? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.