> For the complete documentation index, see [llms.txt](https://danfo.jsdata.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://danfo.jsdata.org/api-reference/series/series.drop_duplicates.md).

# Series.dropDuplicates

> danfo.Series.dropDuplicates(options)

| Parameters | Type   | Description       | Default                                                                                                                                                                                |
| ---------- | ------ | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| options    | Object | **keep**: "first" | <p>"last", which duplicate value to keep. Defaults to "first".<br><strong>inplace</strong>: Boolean indicating whether to perform the operation in-place or not. Defaults to false</p> |

**Returns:** Series

**Examples**

### Drop duplicate by keeping the first occurrence of the duplicate value

{% tabs %}
{% tab title="Node" %}

```javascript
const dfd = require("danfojs-node")

let data1 = [10, 45, 56, 10, 23, 20, 10, 10]
let sf = new dfd.Series(data1)
let sf_drop = sf.dropDuplicates()

sf_drop.print()
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Output" %}

```
╔═══╤════╗
║ 0 │ 10 ║
╟───┼────╢
║ 1 │ 45 ║
╟───┼────╢
║ 2 │ 56 ║
╟───┼────╢
║ 4 │ 23 ║
╟───┼────╢
║ 5 │ 20 ║
╚═══╧════╝
```

{% endtab %}
{% endtabs %}

### Drop duplicate and keep only the last duplicated value

{% tabs %}
{% tab title="Node" %}

```javascript
const dfd = require("danfojs-node")

let data1 = [10, 45, 56, 10, 23, 20, 10, 10]
let sf = new dfd.Series(data1)
let sf_drop = sf.dropDuplicates({ keep: "last" })

sf_drop.print()
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Output" %}

```
╔═══╤════╗
║ 1 │ 45 ║
╟───┼────╢
║ 2 │ 56 ║
╟───┼────╢
║ 4 │ 23 ║
╟───┼────╢
║ 5 │ 20 ║
╟───┼────╢
║ 7 │ 10 ║
╚═══╧════╝
```

{% endtab %}
{% endtabs %}

### Remove duplicate value in-place

{% tabs %}
{% tab title="Node" %}

```javascript
const dfd = require("danfojs-node")

let data1 = ["A", "A", "A", "B", "B", "C", "C", "D"]
let sf = new dfd.Series(data1)
sf.dropDuplicates({ inplace: true })

sf.print()
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Output" %}

```
╔═══╤═══╗
║ 0 │ A ║
╟───┼───╢
║ 3 │ B ║
╟───┼───╢
║ 5 │ C ║
╟───┼───╢
║ 7 │ D ║
╚═══╧═══╝
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://danfo.jsdata.org/api-reference/series/series.drop_duplicates.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
