Advertisement

08.25.2008 at 09:38AM PDT, ID: 23675741
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.6

Python Read/Write csv script example

Asked by kmartinenko in Python Scripting Language

Tags:

Hello,

I am in need of a simple script that I can apply to a project I am working on, for the purpose of learning what each of the functions mean.  I am very new to Python.  

What I would like to learn how to do is read a existing csv file, run a simple function on values in a particular column, and then export (write) the calculated column, with other selected columns to a new .csv file.

I have been reading about the csv.reader and csv.writer commands in Python (using many of the resources recommended on this site), but I am having troubles performing calculations and then writing the new file out in .csv (excel dialect...not sure exactly what this means, but I see it used a lot?)

I have a attached a mock .xls file to give reference.  

The calculation I would like to run is a "greater than or equal to" statement on column D, "LOAD".  
"if LOAD is greater than 20, print 'greater than 20' "
"If LOAD is less than 20, print 'less than 20' "

The outcome I would like is for the program to print out columns A, B, and C, along with a new D column based on the results of the calculation performed on D, "LOAD".  So the new D column should have a mixture of "greater than 20", "less than 20".

Many thanks for the help!Start Free Trial
Attachments:
 
example xls file
 
[+][-]08.25.2008 at 01:04PM PDT, ID: 22308720

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.25.2008 at 01:27PM PDT, ID: 22308948

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.25.2008 at 03:00PM PDT, ID: 22309632

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.25.2008 at 05:43PM PDT, ID: 22310650

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08.26.2008 at 01:12AM PDT, ID: 22312520

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Python Scripting Language
Tags: Python
Sign Up Now!
Solution Provided By: pepr
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.26.2008 at 10:13AM PDT, ID: 22317010

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.26.2008 at 01:49PM PDT, ID: 22319302

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.26.2008 at 02:00PM PDT, ID: 22319437

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.26.2008 at 11:47PM PDT, ID: 22322345

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42 / EE_QW_2_20070628