英文:
Creating tables for clean Data
问题
让我首先说一下,我对Python和Excel有基本的了解。我正在尝试对一个包含电压数据点和日期(日期格式为mm/dd/yyyy)的CSV文件进行处理,将每一天的数据点平均值制成图表。一个月内大约有10000个数据点,每隔5分钟分隔开。我不知道从哪里开始。而且我需要做大约12次类似的操作,所以如果我能够将一个Excel文件或从记事本中读取的数据输入到程序中,那将对我有很大帮助。
我对Python有点生疏,但我可以很好地阅读代码以弄清楚它是如何工作的。任何帮助将不胜感激。
如果可以在Excel中完成所有操作,那将非常棒。但我想要复习一下我的编程技能。如果有人可以指导我,我正在使用Jupyter笔记本和Excel作为参考。我尝试过使用open()
函数打开文件,但现在我甚至不知道从哪里开始。我应该安装pandas吗?还是Selenium?
我尝试手动在Excel中对数据进行分组,使用"Group"功能。我还尝试在Python中打开文件,并创建一个值列表进行遍历和计算平均值。我还研究了使用数据透视表来对数据进行分组。
英文:
let me start out by saying I have a basic understanding of python and excel. What I’m trying to do is take a CSV file with data points for voltages along side with date in mm/dd/yyyy in a separate column, and averaging the data points for each day into a chart. There’s roughly 10000 data points for the month each separated by 5 minute increments. I don’t know where to start. I also have to do this about 12 separate times so if I can just feed a program an excel file or data from notepad that would help me tremendously.
I’m a bit rusty with python but I can read it pretty well to figure out what does what. Any help would be greatly appreciated.
If I can do this all in excel then that would be amazing. But I would like to brush up on my coding. If someone can point me in the right direction, I’m using Jupyter notebook and excel for reference. I tried starting with just opening the file with open() but now I don’t even know where to begin. Should I install pandas? Selenium?
I tried grouping the data in excel manually by using group. I tried opening up files in Python and creating a list of values to go through and average them. I also looked into using pivot tables to group the data as well.
答案1
得分: 0
不需要编程来解决这个问题。Excel透视表可以解决它。
- 将日期列格式化为Excel可以理解的日期格式。
- 从包含您的数据的范围中插入透视表。
- 将日期拖动到左下方的“行”区域。
- 将电压拖动到右下方的“值”区域。
- 将值的聚合方式从“求和”更改为“平均”。
结果将是以下表格:
英文:
No coding needed for that. Excel pivot can solve it.
-
Bring your date column in a format excel understands as date.
-
Insert pivot from the range that contains your data
-
Drag the Date to lower left quadrant
rows
-
Drag the voltage to lower right quadrant
values
-
Change aggregation of values from
sum
toaverage
- The result will be this table:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论