July 2019
Beginner to intermediate
740 pages
16h 52m
English
Since the API endpoint we used could return data of any units and category, it had to call that column value. We only pulled temperature data in Celsius, so all of our observations have the same units. This means that we can rename the value column so that it's clear what data we are working with:
>>> df.columnsIndex(['attributes', 'datatype', 'date', 'station', 'value'], dtype='object')
The DataFrame class has a rename() method that takes a dictionary that maps the old column name to the new column name. We will also rename the attributes column to flags since the API documentation mentions that that column contains flags for information about data collection:
>>> df.rename(... columns={... 'value' : 'temp_C', ... 'attributes' ...Read now
Unlock full access