Missing display code in Communicating Results module step 3

Screen Link: https://app.dataquest.io/m/467/communicating-results/3/cleaning-the-data

The instructions indicate that there is a "clean_size function to set the type of the paid["Size"] column as float".

We cannot see evidence of this in the display code.

Hey, Michelle.

Thank you for reporting this. In the mean time, here’s the function’s definition:

def clean_size(size):
    """Convert file size string to float and megabytes"""
    size = size.replace("M","")
    if size.endswith("k"):
        size = float(size[:-1])/1000
    elif size == "Varies with device":
        size = pd.np.NaN
        size = float(size)
    return size

Hi Bruno,

Shouldn’t line 5 be:

size = float(size[:-1])/1024

to be more exact?


That’s not entirely clear. I suspect 1000 is correct. Basically the standards have changed and in more recent times 1000 bytes equal 1K. See this Wikipedia article for more information.