Dataset Viewer
Duplicate
The dataset viewer is not available for this split.
Cannot load the dataset split (in streaming mode) to extract the first rows.
Error code:   StreamingRowsError
Exception:    TypeError
Message:      expected bytes, int found
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/src/worker/utils.py", line 147, in get_rows_or_raise
                  return get_rows(
                      dataset=dataset,
                  ...<4 lines>...
                      column_names=column_names,
                  )
                File "/src/libs/libcommon/src/libcommon/utils.py", line 272, in decorator
                  return func(*args, **kwargs)
                File "/src/services/worker/src/worker/utils.py", line 127, in get_rows
                  rows_plus_one = list(itertools.islice(safe_iter(ds, dataset=dataset), rows_max_number + 1))
                File "/src/services/worker/src/worker/utils.py", line 483, in safe_iter
                  yield from ds.decode(False) if ds.features else ds
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2840, in __iter__
                  for key, example in ex_iterable:
                                      ^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2373, in __iter__
                  for key, pa_table in self._iter_arrow():
                                       ~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2397, in _iter_arrow
                  schema = self.features.arrow_schema
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/features/features.py", line 1947, in arrow_schema
                  return pa.schema(self.type).with_metadata({"huggingface": json.dumps(hf_metadata)})
                                   ^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/features/features.py", line 1936, in type
                  return get_nested_type(self)
                File "/usr/local/lib/python3.14/site-packages/datasets/features/features.py", line 1426, in get_nested_type
                  {key: get_nested_type(schema[key]) for key in schema}
                        ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/features/features.py", line 1441, in get_nested_type
                  value_type = get_nested_type(schema.feature)
                File "/usr/local/lib/python3.14/site-packages/datasets/features/features.py", line 1430, in get_nested_type
                  {key: get_nested_type(schema[key]) for key in schema}
                        ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/features/features.py", line 1429, in get_nested_type
                  return pa.struct(
                         ~~~~~~~~~^
                      {key: get_nested_type(schema[key]) for key in schema}
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  )  # however don't sort on struct types since the order matters
                  ^
                File "pyarrow/types.pxi", line 5340, in pyarrow.lib.struct
                File "pyarrow/types.pxi", line 3836, in pyarrow.lib.field
                  new CField(tobytes(name), _type.sp_type, nullable, c_meta)
                File "<stringsource>", line 15, in string.from_py.__pyx_convert_string_from_py_6libcpp_6string_std__in_string
              TypeError: expected bytes, int found

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

Open Food Facts Canada Dataset

A Canada-focused subset of the Open Food Facts food product database, distributed as a Parquet file.

Dataset

Property Value
File openfoodfacts_canada.parquet
Rows 124,145
Columns 25
Unique barcodes 124,145
Duplicate barcode rows 0
Canada coverage 100% of records contain Canada in countries_tags
Image metadata Available in images for all records
Front image URLs 28,608 records (23.044% coverage)
Format Parquet

Scope

Every record contains Canada in countries_tags. The dataset is Canada-focused rather than strictly Canada-only: 6,583 records also contain other country or world tags.

Important columns

  • code: Product barcode, stored as a string.
  • product_name: Product name.
  • brands: Brand information when available.
  • categories and categories_tags: Product category information when available.
  • ingredients_text: Ingredient text when available.
  • nutriments: Nutritional data when available.
  • nutriscore_grade and nutriscore_score: Nutri-Score data when available.
  • nova_group: NOVA group classification when available.
  • countries_tags: Country tags used for the Canada-focused selection.
  • images: Structured image metadata.
  • completeness: Product data completeness value.
  • last_modified_t: Product modification timestamp from the source data.
  • front_image_url: Derived front-image URL when suitable front_en image metadata is available.

Data notes

  • Barcode values must be treated as strings so leading zeroes are preserved. In this dataset, 113,135 barcode values begin with zero.
  • Front image URLs are not available for every product. There are 95,537 records without a front image URL.
  • Several product, ingredient, category, label, nutrition, quantity, and serving-size fields contain null values.
  • This repository does not claim that every product has an image.

Source and reproduction

The included OFF_Canada_Data_Code.ipynb loads the openfoodfacts/product-database dataset from Hugging Face using the food split. It filters records whose countries_tags contain en:canada, selects the dataset columns, and derives front_image_url values from front_en image metadata when image ID and revision values are available.

The notebook is written for Google Colab. It installs datasets and duckdb, downloads the source Parquet file, creates the Canada-focused Parquet output, adds front-image URLs, and downloads the resulting file. The notebook writes an output named off_canada_with_images.parquet; the repository copy is named openfoodfacts_canada.parquet.

Repository files

License

No license is specified in this repository.

Downloads last month
24