当前位置:网站首页>Excel自动化之13种方法来避免在 Microsoft Excel 中重复任务
Excel自动化之13种方法来避免在 Microsoft Excel 中重复任务
2022-07-23 19:49:00 【知识大胖】
一年多前,我在之前担任数据分析师时开始学习 Python。我当时工作的公司都是关于 Excel 的。每个月我都必须清理和合并从世界各地收集的近 100 个不同的文件——正如你可以想象的那样,这是一场噩梦!由于客户的性质,这是一个古老的故事,即交付分析的周转时间非常紧迫,导致压力瓶颈再次出现。
最初,我使用 VBA 来自动化我的一些每月工作,但是我发现如果数据集格式每月略有不同,它就会变得相当僵化。我也遇到了 Excel 崩溃的严重问题,尤其是随着数据量的增长。然后我发现了 Python,它确实改变了我的生活!当某些文件格式不同时,我可以很容易地相应地更新和修改我的 Python 脚本。也没有更多的文件崩溃和丢失我的工作。
1.导入Excel并确保日期是日期时间对象
首先,您需要将 Excel 文件读入 Pandas 数据框。我最初使用数据框时遇到的一个问题是使用日期。当我了解 datetime 类型时,这开启了格式化、日期计算等等的可能性。
pd.read_excel(file_path, parse_dates=['date_col1', 'date_col2']
实际测试数据
日期测试数据:02date.zip
ndate = pd.read_excel("日期.xlsx",parse_dates=['出生日期','采样时间','登记时间'])
这里,file_path是您需要清理的 Excel 文件的位置,以及文件名和文件扩展名。将datecol1和替换datecol2为带有日期的列名 — 您始终可以在列表中添加或删除更多内容,或删除第二
边栏推荐
- 数组——27. 移除元素
- [PM2] PM2 common commands
- 重装系统后故障(报错:reboot and select proper boot deviceor insert boot media in selected boot device)
- How to solve the problem that the solid state disk cannot be found when installing win11?
- phar反序列化
- 【Unity项目实践】关卡解锁
- Leetcode 238. product of arrays other than itself
- 去广场吃饭
- 数仓4.0笔记——数仓环境搭建—— DataGrip准备和数据准备
- Leetcode 209. subarray with the smallest length
猜你喜欢
随机推荐
Reduced order method of linear algebraic determinant calculation method
千呼万唤,5G双卡双通到底有多重要?
梅科尔工作室-小熊派开发笔记2
Discussion on the usage of scanf () and getchar ()
从200W超级闪充看iQOO 10 Pro的 “共情”能量
dokcer镜像理解
When using polymorphism, two ideas to judge whether it can be transformed downward
21. Mix in details
Leetcode 152. 乘积最大子数组(暴力破解居然可以通过!)
Detailed writing process of impala
数组——209.长度最小的子数组
Leetcode 209. subarray with the smallest length
Training log on July 22, 2022
Task03 notes 2
next数值型数据类型()出现输入错误后,下次依然能正常输入
Leetcode 219. duplicate Element II exists (yes, resolved)
The full text of Li Hongzhang's deathbed poem
【问题处理】Merge made by the ‘ort‘ strategy.
QT下assimp库的模型加载
Typescript use of new data type symbol







![Relevant interfaces of [asp.net core] option mode](/img/2e/847e7541cfc49fd69794089dce2df2.jpg)

