Skip to content

Commit

Permalink
chore(docs): add contains to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxiao committed Jan 10, 2022
1 parent abbb63b commit 9112c5a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/fundamentals/documentarray/access-attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ for d in da:

## Dunder syntax for nested attributes

Some attributes are nested by nature, e.g. `.tags` and `.scores`. Accessing the deep nested value is easy thanks to the dunder syntax. You can access `.tags['key1']` via `d[:, 'tags__key1']`.
Some attributes are nested by nature, e.g. `.tags` and `.scores`. Accessing the deep nested value is easy thanks to the dunder (double under) expression. You can access `.tags['key1']` via `d[:, 'tags__key1']`.

Let's see an example,

Expand Down
17 changes: 17 additions & 0 deletions docs/fundamentals/documentarray/access-elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ print(da['7e27fa246e6611ec9a441e008a366d49', '7e27fb826e6611ec9a441e008a366d49']

No need to worry about efficiency here, it is `O(1)`.

Based on the same technique, one can check if a Document is inside a DocumentArray via Python `in` syntax:

```python
from docarray import DocumentArray, Document

da = DocumentArray.empty(10)

da[0] in da
Document() in da
```

```text
True
False
```


## Index by boolean mask

You can use a boolean mask to select Documents. This becomes useful when you want to update or filter our certain Documents:
Expand Down
4 changes: 2 additions & 2 deletions docs/get-started/what-is.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# What is DocArray?

- It is like JSON, but for intensive computing.
- It is like JSON, but for intensive computation.
- It is like `numpy.ndarray`, but for unstructured data.
- It is like `pandas.DataFrame`, but for nested and mixed media data.
- It is like `pandas.DataFrame`, but for nested and mixed media data with embeddings.
- It is like Protobuf, but for data scientists and deep learning engineers.

If you are a **data scientist** who works with image, text, video, audio data in Python all day, you should use DocArray: it can greatly accelerate the work on representing, embedding, matching, visualizing, evaluating, sharing data; while stay close with your favorite toolkits, e.g. Torch, Tensorflow, ONNX, PaddlePaddle, JupyterLab, Google Colab.
Expand Down

0 comments on commit 9112c5a

Please sign in to comment.