Git Product home page Git Product logo

Comments (3)

pabluk avatar pabluk commented on June 5, 2024

I was looking at this issue and it could be maybe closed, because for:

  1. all the memory values containing "GB" were fixed/removed on this commit
  2. test_read_format() is currently validating type conversion when reading values

Otherwise, maybe if the idea is to enforce strict floating point number format (e.g 4.0 instead of 4), in that case probably checking int conversion before float could allow to check that:

>>> int('4.0')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '4.0'
>>> float('4.0')
4.0

and that change will impact all the float type fields of DeviceCarbonFootprintData.

Do you have any advice on this? if this issue is still valid I could add a test for that, fix all parsers that generate float values and updated CSV files.

from environmental-footprint-data.

ggael avatar ggael commented on June 5, 2024

This issue was more about checking all parsers to make sure that they do verify that the number they read is in GB and make the conversion if it's not the case (AFAIR there are a few cases for which the reported unit is not in GB)

from environmental-footprint-data.

pabluk avatar pabluk commented on June 5, 2024

Oh I see, thanks for the explanation.

Looking at the current data on boavizta-data-us.csv indeed, there are some suspicious memory values:

>>> import csv
>>> 
>>> with open('boavizta-data-us.csv', 'rt', encoding='utf-8') as data_file:
...     reader = csv.DictReader(data_file)
...     memory_values = [row['memory'] for row in reader if row['memory']]
... 
>>> unique_values = list(set(memory_values))
>>> unique_values.sort(key=float)
>>> unique_values
['3.0', '4.0', '6.0', '8.0', '8', '12.0', '16.0', '16', '32.0', '32', '48.0', '64.0', '64', '128', '256']

for example, 256GB of RAM on a server could be normal but not for a smartphone:

>>> import csv
>>> 
>>> with open('boavizta-data-us.csv', 'rt', encoding='utf-8') as data_file:
...     reader = csv.DictReader(data_file)
...     for row in reader:
...         if row['memory'] and float(row['memory']) >= 128:
...             print(row['manufacturer'], row['name'], row['subcategory'], row['memory'])
... 
Apple iPhone 11 128GB Smartphone 128
Apple iPhone 11 256GB Smartphone 256
Apple iPhone 12 128GB Smartphone 128
Apple iPhone 12 256GB Smartphone 256
Apple iPhone 8 256GB Smartphone 256
Apple iPhone SE - Gen 2 128GB Smartphone 128
Apple iPhone SE - Gen 2 256GB Smartphone 256
Dell PowerEdge R830 Server 256
Dell PowerEdge R840 Server 128
Dell PowerEdge R930 Server 256

it seems that Apple's parser is incorrectly filling the memory field with storage capacity from iPhones. Even if it isn't a unit/scale issue, the parser need to be reviewed.

from environmental-footprint-data.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.