diff --git a/src/Internal/Frame/KeyTypes.php b/src/Internal/Frame/KeyTypes.php index a23640a..4cf0e33 100644 --- a/src/Internal/Frame/KeyTypes.php +++ b/src/Internal/Frame/KeyTypes.php @@ -15,15 +15,22 @@ private function types(DataFrame $frame): array { $types = []; foreach ($frame->dataset() as $dataRow) { - foreach ($dataRow->keys as $index => $key) { - if ($dataRow->isAssociative($index)) { - $types[$this->typeOf($key)] = true; - } + foreach ($this->associativeKeys($dataRow) as $key) { + $types[$this->typeOf($key)] = true; } } return \array_keys($types); } + private function associativeKeys(DataRow $row): \Iterator + { + foreach ($row->keys as $index => $key) { + if ($row->isAssociative($index)) { + yield $key; + } + } + } + public function uniformTypes(): bool { if ($this->arrayKeyTypes($this->types)) {