<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Adjusting, Renaming and Restructuring
Step1:  We can use several functions to get a quick overview over the MRIO system
Step2:  A list of available satellite accounts can be obtained by
Step3:  this returns a generator over all extensions, to just get the names which can be used to loop over the extensions. To just get the names
Step4:  All the names returned are literally just names and can easily be renamed.
To rename sectors or regions just pass a dictionary with the new names
Step5:  Renaming sectors or Y categories works the same way
Step6:  Some MRIOs come with a selections of names which can be used for renaming.
These can be obtained via 'get_classification', passing the name of the IO (pass None to get a list of available classifications).
Step7:  The classification data contains different names and aggregation levels for the sectors and final demand categories. The easiest way to explore the classification data is by using the autocomplete functionality. Depending on the editor your are using this might work with typing mrio_class.sectors. pressing Tab or Ctrl-Space. The same works for mrio_class.finaldemand.
Alternatively it is possible to just print the underlying dataframes with (similar for finaldemand)
Step8:  This can be used to generate dictionaries for renaming the sectors of the MRIO, eg with
Step9:  This can then be used for renaming the sectors
<ASSISTANT_TASK:>
Python Code:
import pymrio
mrio = pymrio.load_test()
Explanation: Adjusting, Renaming and Restructuring
End of explanation
mrio.get_sectors()
mrio.get_regions()
mrio.get_Y_categories()
Explanation: We can use several functions to get a quick overview over the MRIO system:
End of explanation
mrio.get_extensions()
Explanation: A list of available satellite accounts can be obtained by
End of explanation
list(mrio.get_extensions())
Explanation: this returns a generator over all extensions, to just get the names which can be used to loop over the extensions. To just get the names:
End of explanation
mrio.rename_regions({"reg1": "REGION A", "reg2": "REGION B"})
mrio.get_regions()
Explanation: All the names returned are literally just names and can easily be renamed.
To rename sectors or regions just pass a dictionary with the new names:
End of explanation
mrio.rename_sectors({"mining": "dwarf business"})
mrio.rename_Y_categories({"Final consumption expenditure by households": "fin_house"})
mrio.get_sectors()
mrio.get_Y_categories()
Explanation: Renaming sectors or Y categories works the same way
End of explanation
mrio_class = pymrio.get_classification(mrio_name="test")
Explanation: Some MRIOs come with a selections of names which can be used for renaming.
These can be obtained via 'get_classification', passing the name of the IO (pass None to get a list of available classifications).
End of explanation
mrio_class.sectors
Explanation: The classification data contains different names and aggregation levels for the sectors and final demand categories. The easiest way to explore the classification data is by using the autocomplete functionality. Depending on the editor your are using this might work with typing mrio_class.sectors. pressing Tab or Ctrl-Space. The same works for mrio_class.finaldemand.
Alternatively it is possible to just print the underlying dataframes with (similar for finaldemand)
End of explanation
conv_dict = mrio_class.get_sector_dict(mrio_class.sectors.TestMrioName, mrio_class.sectors.TestMrioCode)
conv_dict
Explanation: This can be used to generate dictionaries for renaming the sectors of the MRIO, eg with:
End of explanation
mrio = pymrio.load_test()
mrio.rename_sectors(conv_dict)
mrio.get_sectors()
Explanation: This can then be used for renaming the sectors:
End of explanation
<END_TASK>