Question: How to get product **attribute group** in magento 2 from a **attribute set**. I want to show attribute on **listing page** by using a group so i can add more attributes in future

Answer: 
you simply get all product attribute by `$product->getAttributes();`

```
$productAttributes=$product->getAttributes();
        $group_id=9;
        $attributeSetId=4;
        foreach ($productAttributes as $attribute) {
            if ($attribute->isInGroup($attributeSetId, $group_id)) {
             echo $attribute->getFrontendLabel().' : '.$attribute->getFrontend()->getValue($product).'<br />';
            }

    }

```
We can use `getAttributeGroupId` method:

*vendor/magento/module-catalog/Model/Config.php*

```
public function getAttributeGroupId($attributeSetId, $name)
{
   ......     
}

```

We can get attribute group id:

```
   $obj = \Magento\Framework\App\ObjectManager::getInstance();

    /** @var \Magento\Catalog\Model\Config $config */
    $config= $obj->get('Magento\Catalog\Model\Config');

    $attributeGroupId = $config->getAttributeGroupId(1, 'General');

```

Should take a look `eav_attribute_group`.