Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid mutate by using expressions in merges #18

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion computer_vision/fashion_product_images/1-quick-start.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@
}
],
"source": [
"dc_annotated = dc.mutate(filename=path.name(C(\"file.path\"))).merge(dc_meta, on=\"filename\")\n",
"dc_annotated = dc.merge(dc_meta, on=path.name(dc.c(\"file.path\")), right_on=\"filename\")\n",
"\n",
"dc_annotated.show(3)"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
dc_meta.show(3)

print("\n# Merge the original image and metadata datachains")
dc_annotated = dc.mutate(filename=path.name(C("file.path"))).merge(
dc_meta, on="filename"
)
dc_annotated = dc.merge(dc_meta, on=path.name(dc.c("file.path")), right_on="filename")

print("\n# Save dataset")
dc_annotated.save("fashion-product-images")
Expand Down
6 changes: 3 additions & 3 deletions formats/json-metadata-tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1783,7 +1783,7 @@
}
],
"source": [
"images_meta = images.mutate(file_name=path.name(Column(\"file.path\"))).merge(meta, on=\"file_name\", right_on=\"image.file_name\", inner=True)\n",
"images_meta = images.merge(meta, on=path.name(images.c(\"file.path\")), right_on=\"image.file_name\", inner=True)\n",
"images_meta.print_schema()"
]
},
Expand Down Expand Up @@ -2176,10 +2176,10 @@
"cats = instances.filter(Column(\"instance.category_id\") == coco_dict[\"cat\"])\n",
"\n",
"# drop all columns in \"cats\" except id and the filename we will be merging on, rename columns to avoid collision at merge\n",
"cat_ids = cats.mutate(cat_id=Column(\"instance.id\")).mutate(cat_fpath=Column(\"file.path\")).select(\"cat_id\", \"cat_fpath\")\n",
"cat_ids = cats.mutate(cat_id=Column(\"instance.id\")).select(\"cat_id\", \"file.path\")\n",
"\n",
"# inner = True, drop all records without a merging match:\n",
"cats_and_dogs = dogs.merge(cat_ids, on=\"file.path\", right_on=\"cat_fpath\", inner=True)"
"cats_and_dogs = dogs.merge(cat_ids, on=\"file.path\", inner=True)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion multimodal/clip_fine_tuning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@
"metadata": {},
"outputs": [],
"source": [
"dc = img_dc.mutate(filename=path.name(C(\"file.path\"))).merge(meta_dc, on=\"filename\")"
"dc = img_dc.merge(meta_dc, on=path.name(img_dc.c(\"file.path\")), right_on=\"filename\")"
]
},
{
Expand Down