How can I have access to values in a table with values() or iteritems()

Taabi

image of sample table

I have created a table containing header rows, header columns, column ids and row ids (the above picture is a very simple example of the table structure), and have used some methods of a specific class to convert the table to weighted flat cross-tab and pivot cross tab, etc. Now what I'm looking for is to test if the values in the table are float , so I've developed a unittest test suite. I have used Table.values(), or Table.iteritems(), but these two methods iterate over all the Table including the headers and ids which are all strings , therefor the test is failed. Does anyone have a better solution to iterate only the values of the table regardless of the labels in the table?

    row_ids=['g','p']
    col_ids=['r','c']
    values = { ('g','r'): 0.75, ('g','c'): 0.25, ('p','r'): 0.5, ('p','c'): 0.5, }
    header_row = { 'id':'forme', 'type':'string' }
    header_col = { 'id':'taille', 'type': 'string', } 

What I'm looking for is to only read the values in the values dictionary, but with values() and items() the output is a tuple of key and value. That's why the test is failed.

Tom Zych

I think you mean you want to do this:

for k, v in values.iteritems():
    if k: # if k has a value indicating this is a header:
        continue  # skip it
    if not isinstance(v, float):
        print 'bad value: ', k, v

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I access the RGB values of a UIColor?

From Dev

How can I access particular column values?

From Dev

How can I access the values in this NSDictionary in Swift?

From Dev

How can I access particular column values?

From Dev

How can I access values in this JSON?

From Dev

How can i calculate table values

From Dev

In Postgresql, how can I fetch an unknown # of records from a table that have M distinct values in one column?

From Dev

In Postgresql, how can I fetch an unknown # of records from a table that have M distinct values in one column?

From Dev

Php : How can I make values that have been saved in a table appear on the page as being checked?

From Dev

How can I access selected report filter values in Excel Pivot table from VBA code or Formulas?

From Dev

How can I save values in a array when I have a foreach?

From Java

How can I check if the array of objects have duplicate property values?

From Dev

How can i have 2 sticky headers with dynamic height values

From Dev

how can i search for values that have "-" dash in them with elastic search

From Dev

NSDictionary seems to have multiple values for one key, how do I access the individual values?

From Dev

How can i access QueryString values in Serializer Django Rest Framework

From Dev

how can I access the values of XML nodes using DOM API

From Dev

How can I access the associated values of SwiftyDropbox errors?

From Dev

In firebase how can i give read access to multiple child values

From Dev

How can I access certain values in this JSON string?

From Dev

How can I access CURRENT values of environment variables in Python

From Dev

how can I access @-values of preceding-sibling in xslt

From Dev

How can I access list values using DOM in javascript?

From Dev

Can various users access the same table in database and have different values for everyone?

From Dev

I have a Data Table in which i have a column with decimal values

From Dev

How can I prevent certain combinations of values in a table, derived from the values already in the table?

From Dev

How can I SUM values in a joined table without screwing up totals of values in the first table?

From Dev

How can I prevent certain combinations of values in a table, derived from the values already in the table?

From Dev

This code is sending empty values to the table. How can I fix this

Related Related

  1. 1

    How can I access the RGB values of a UIColor?

  2. 2

    How can I access particular column values?

  3. 3

    How can I access the values in this NSDictionary in Swift?

  4. 4

    How can I access particular column values?

  5. 5

    How can I access values in this JSON?

  6. 6

    How can i calculate table values

  7. 7

    In Postgresql, how can I fetch an unknown # of records from a table that have M distinct values in one column?

  8. 8

    In Postgresql, how can I fetch an unknown # of records from a table that have M distinct values in one column?

  9. 9

    Php : How can I make values that have been saved in a table appear on the page as being checked?

  10. 10

    How can I access selected report filter values in Excel Pivot table from VBA code or Formulas?

  11. 11

    How can I save values in a array when I have a foreach?

  12. 12

    How can I check if the array of objects have duplicate property values?

  13. 13

    How can i have 2 sticky headers with dynamic height values

  14. 14

    how can i search for values that have "-" dash in them with elastic search

  15. 15

    NSDictionary seems to have multiple values for one key, how do I access the individual values?

  16. 16

    How can i access QueryString values in Serializer Django Rest Framework

  17. 17

    how can I access the values of XML nodes using DOM API

  18. 18

    How can I access the associated values of SwiftyDropbox errors?

  19. 19

    In firebase how can i give read access to multiple child values

  20. 20

    How can I access certain values in this JSON string?

  21. 21

    How can I access CURRENT values of environment variables in Python

  22. 22

    how can I access @-values of preceding-sibling in xslt

  23. 23

    How can I access list values using DOM in javascript?

  24. 24

    Can various users access the same table in database and have different values for everyone?

  25. 25

    I have a Data Table in which i have a column with decimal values

  26. 26

    How can I prevent certain combinations of values in a table, derived from the values already in the table?

  27. 27

    How can I SUM values in a joined table without screwing up totals of values in the first table?

  28. 28

    How can I prevent certain combinations of values in a table, derived from the values already in the table?

  29. 29

    This code is sending empty values to the table. How can I fix this

HotTag

Archive