User Profile

Collapse

Profile Sidebar

Collapse
larafaelivrin
larafaelivrin
Last Activity: Feb 16 '15, 03:26 PM
Joined: Jan 30 '15
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Aha, maybe I figured out how to do it:

    data = open("Test.csv" , "r")
    print data.read()

    but now I get this error:
    Traceback (most recent call last):
    File "/home/katharina/Desktop/Test.py", line 14, in <module>
    dataLines = data.split("\n" )
    AttributeError: 'file' object has no attribute 'split'

    and if I uncomment the dataLines line...
    See more | Go to post

    Leave a comment:


  • Another question (sry...): If I import my csv file I get the fallowing structure:

    ['15', 'A', '50']
    ['10', 'A', '50']
    ['12', 'B', '30']
    ['10', 'C', '30']
    ['5', 'D', '50']
    ['10', 'D', '50']

    How do you import your csv file without listing each row separately? I don“t seem to be able to figure out what I am doing wrong...
    See more | Go to post

    Leave a comment:


  • I just copied your code and it works perfectly! Thank you so much!! I will try to understand what you did and maybe I can get back to you in case I do not understand something. Thanks!:)
    See more | Go to post

    Leave a comment:


  • ok but with this solution I get several output for Polygon A and D. I am interested in summarizing the wooden Areas for each Polygon which has the same name. For Polygon A for example this would be 15+20/50. Is the quickest way to sum up the outputs or to do this step beforehand? Thanks a lot!!
    See more | Go to post

    Leave a comment:


  • no, there are arcpy tools which you can call and as I understand they simplify the steps. But the problem is that some of them take very long to run. This website shows me how to read a csv file (https://docs.python.org/2/library/csv.html) and I managed to do that but how can I group the variables? Is there a function?
    See more | Go to post

    Leave a comment:


  • larafaelivrin
    started a topic Python csv calculate percentage by group

    Python csv calculate percentage by group

    I have a table (csv file) with three columns:

    Wood [m2] Polygon Area [m2]
    15 A 50
    10 A 50
    12 B 30
    10 C 30
    05 D 50
    10 D 50

    My aim is to calculate the percentage of wood for each Polygon. I want to print this result into a new csv table:

    Polygon Percentage of Wood (%)...
    See more | Go to post
No activity results to display
Show More
Working...