In the above script we created an object of 'core_setup' i.e., $setup and then in the addAttribute() method we defined our attribute.
In the addAttribute() method we passed the parameters are :
1- Entity Type Id : It is an entity type string i.e., 'catalog_product' which can be an integer value. This information found in eav_entity_type table.
2- Attribute Code : It is an attribute code in our case we have passed 'warranty_period'.
3- Data Array : This array defines the values of the attribute code.
In this Data Array of the attribute code, if we notice we have first passed the array parameter which is a group. In this case it has value 'Prices' because we are required to add the attribute in this group only. Afterwards we defined other properties of the attribute code accordingly.
Now, Install your module and after clearing the cache then hit the root url of the setup. Afterwards the script gets run and the attribute with the defined properties gets created, Which will get appears in the products price tab in manage products at the admin panel.