# Problem on Benchmark Code

**URL:** <https://community.drivendata.org/t/problem-on-benchmark-code/6867>\
**Category:** On Cloud N\
**Created:** [December 14, 2021, 4:54am UTC](https://community.drivendata.org/t/problem-on-benchmark-code/6867 "2021-12-14T04:54:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tashin](https://avatars.discourse-cdn.com/v4/letter/t/e79b87/32.png) [@Tashin](https://community.drivendata.org/u/Tashin)\
**Post date:** [December 14, 2021, 4:54am UTC](https://community.drivendata.org/t/problem-on-benchmark-code/6867/1 "2021-12-14T04:54:40Z")

</div>

I was skimming through the benchmark notebook you introduced in your blog.

```auto
def add_paths(df, feature_dir, label_dir=None, bands=BANDS):
    """
    Given dataframe with a column for chip_id, returns a dataframe with a column
    added indicating the path to each band's TIF image as "{band}_path", eg "B02_path".
    A column is also added to the dataframe with paths to the label TIF, if the
    path to the labels directory is provided.
    """
    for band in bands:
        df[f"{band}_path"] = feature_dir / df["chip_id"] / f"{band}.tif"
        assert df[f"{band}_path"].path.exists().all()
    if label_dir is not None:
        df["label_path"] = label_dir / (df["chip_id"] + ".tif")
        assert df["label_path"].path.exists().all()

    return df

train_meta = add_paths(train_meta, TRAIN_FEATURES, TRAIN_LABELS)
train_meta.head()

```

The above code cell is throwing an error:  
**TypeError: expected str, bytes or os.PathLike object, not Series**

Hope you will fix it.

---

<div class="post-metadata">

**Author:** ![Tashin](https://avatars.discourse-cdn.com/v4/letter/t/e79b87/32.png) [@Tashin](https://community.drivendata.org/u/Tashin)\
**Post date:** [December 14, 2021, 10:40am UTC](https://community.drivendata.org/t/problem-on-benchmark-code/6867/2 "2021-12-14T10:40:46Z")

</div>

**This can be a probable solution -**

```auto
def add_paths(df, feature_dir, label_dir=None, bands=BANDS):
  for band in bands:
      band_paths = []
      for chip_id in df.chip_id:
          current_path = feature_dir / chip_id / f"{band}.tif"
          band_paths.append(current_path)
          assert current_path.is_file()
      df[f"{band}_path"] = band_paths
  if label_dir is not None:
      label_paths = []
      for chip_id in df.chip_id:
          current_path = label_dir / (chip_id + ".tif")
          assert current_path.is_file()
      df["label_path"] = label_paths
  return df

train_meta = add_paths(train_meta, TRAIN_FEATURES, TRAIN_LABELS)
train_meta.head()

```

---

<div class="post-metadata">

**Author:** ![kwetstone](https://avatars.discourse-cdn.com/v4/letter/k/ee7513/32.png) [@kwetstone](https://community.drivendata.org/u/kwetstone)\
**Post date:** [December 14, 2021, 2:20pm UTC](https://community.drivendata.org/t/problem-on-benchmark-code/6867/3 "2021-12-14T14:20:01Z")

</div>

@Tashin That error is not raised when we run the benchmark - we are able to run it from end to end with no issues.

If you provide more detail on your error (eg. the stack trace, what you are using as arguments) others may be able to help debug. One thought is to check the competition [runtime](https://github.com/drivendataorg/cloud-cover-runtime) environment specifications and see if you have any mismatching package versions.

You could also run the notebook the Planetary Computer Hub instead - it is available in their tutorials [here](https://github.com/microsoft/PlanetaryComputerExamples/blob/main/competitions/cloud-cover/benchmark-tutorial.ipynb).

Good luck!
