从头开始...... [英] Starting at the beginning...

查看:72
本文介绍了从头开始......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好...


我对编程很新,但不是电脑。我正在努力扩展我的技能,超越我在Excel中所做的工作。一个月前我开始使用Python。我觉得事情已经接近点击了我但是我需要从专家那里得到一些推动让我超过驼峰。


我不是在寻找帮助编写脚本本身,但实际上正在寻找有关如何处理我的项目的见解。我一直在阅读有关元组和列表以及泡菜和书架的内容,我发现自己对于采用哪种方式感到有些困惑。


该项目以我从网站下载的.csv文件开始。有14列数据和大约1500行或记录。


最初,我需要读取文件,重新排序列,从一列中删除一些字符,比较值2不同的字段并突出显示大于20%的偏差,将一列的值相加并将修改后的记录打印到文件中。


我一直在玩,并创建了pickle文件和搁置文件,但有可视化的工作顺序...我甚至想要去那条路线,或者我应该只是看看,也许???


您的意见将不胜感激!!

Hello...

I m very new to programming but not to computers. I am trying to expand my skills beyond what I do in Excel. I started working with Python about a month ago. I feel things are close to clicking for me but I need a bit of a nudge from an expert to get me over the hump.

I am not looking for help writing a script per se, but actually looking for insight on how to approach my project. I have been reading about tuples and lists and pickles and shelves and I find myself a bit perplexed on which way to proceed.

The project starts with a .csv file that I download from a website. There are 14 columns of data and roughly 1500 rows or records.

Initially, I need to read the file, reorder the columns, strip some characters from one column, compare the values of 2 different fields and highlight a deviation of greater than 20%, sum the value of one column and print revised records to a file.

I have been playing around with and have created pickle files and shelve files but have had problems visualizing the order in which to work this out...do I even want to go that route or should I just be looking at re, maybe???

Your thoughts would be appreciated!!

推荐答案

Python内置模块 csv 适合您的应用。取而代之的是,这种方法部分取决于数据本身。如果您的数据有标题行,则可以使用列标题作为键将所有数据读入字典。我有一个简单的例子。如果您的任何数据嵌入了逗号,则此操作无效(带嵌入逗号的数据必须用引号括起来)。以下是示例文件:
Python built-in module csv may be ideal for your application. Instead of that, the approach to this partly depends on the data itself. If your data has a header line, you can read all the data into a dictionary using the column headers as keys. I have a simple example. This will not work if any of your data has embedded commas (the data with embedded commas must be enclosed in quotes). Following is the sample file:
展开 | 选择 | Wrap | 行号


感谢您的快速回复!


通过专栏打破这个方向绝对是一个不同于我看到的方向......我专注于行...


我花了一段时间回复,因为我用我的数据试了一下,更不用说我现在正在工作。它很棒!我会花一点时间让你对你发送的内容感到更舒服并尝试添加它。我看到你的专栏总数,并且不得不对它进行评论,直到我找出适合我的数据。


我有一个问题,但是...是数据在字典中,当我比较字段时,我将引用所有公式中的字典键...正确吗?


我相信这可能是我需要的轻推......非常感谢!!
Thanks for the quick response!

Breaking this up by columns was definitely a different direction than I was seeing...I was focused on the rows...

It took me a while to reply back because I tried it out with my data, not to mention I''m at work now. It works great! I''m going to spend a little time getting more comfortable with what you sent and try to add to it. I saw your column total and had to comment it out until I figure out the adaptation for my data.

I have one question, though...being that the data is in a dictionary, when I compare fields I''ll be referencing the dictionary keys in all formulas...correct?

I do believe this may have been the nudge I needed...thanks very much!!



感谢您的快速回复!


通过专栏打破这个方向绝对是一个不同于我看到的方向......我专注于行...


我花了一段时间回复,因为我用我的数据试了一下,更不用说我现在正在工作。它很棒!我会花一点时间让你对你发送的内容感到更舒服并尝试添加它。我看到你的专栏总数,并且不得不对它进行评论,直到我找出适合我的数据。


我有一个问题,但是...是数据在字典中,当我比较字段时,我将引用所有公式中的字典键...正确吗?


我相信这可能是我需要的轻推......非常感谢!!
Thanks for the quick response!

Breaking this up by columns was definitely a different direction than I was seeing...I was focused on the rows...

It took me a while to reply back because I tried it out with my data, not to mention I''m at work now. It works great! I''m going to spend a little time getting more comfortable with what you sent and try to add to it. I saw your column total and had to comment it out until I figure out the adaptation for my data.

I have one question, though...being that the data is in a dictionary, when I compare fields I''ll be referencing the dictionary keys in all formulas...correct?

I do believe this may have been the nudge I needed...thanks very much!!



非常欢迎您。我很高兴听到有你热情的人。


假设你想要显示列''Data 1''和列''Data 3''之间的差异,如果它超过1.0,并且两列都包含浮点数数字。

You are very welcome. I am pleased hearing from someone with your enthusiasm.

Let''s say you want to display the difference between column ''Data 1'' and column ''Data 3'' if it exceeds 1.0, and both columns contain floating point numbers.

展开 | 选择 | Wrap | 行号


这篇关于从头开始......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆