I am not sure why stock info is present in code of previous answer. There are easier, and surely faster, ways to update attributes values (but depending by the attribute type it could need some extra code)
Using \Magento\Catalog\Model\ResourceModel\Product\Action & \Magento\Catalog\Model\Product\Attribute\Repository
You can just do
$product = $this->_productRepository->get($sku);
$this->_action->updateAttributes(
array($product->getId()),
array('YOUR_ATTRIBUTE_CODE' => $YOUR_ATTRIBUTE_VALUE),
1
);
That last parameter is store_id, in this example: 1