# Clustering

**Module:** `sovai.extensions.clustering`

## Functions

### `pandas_to_array()`

```python
def pandas_to_array(df_accounting, days = None, features_select = None)
```

***

### `calculate_number_of_clusters()`

```python
def calculate_number_of_clusters(n_tickers)
```

***

### `hash_dataframe()`

```python
def hash_dataframe(df)
```

***

### `segment_series_cached()`

```python
def segment_series_cached(df_hash, features_select_hash)
```

***

### `segment_series()`

```python
def segment_series(df_accounting, features_select = None)
```

***

### `cluster()`

```python
def cluster(df_mega, features_select = None)
```

***

### `calculate_mean_last_6_months()`

```python
def calculate_mean_last_6_months(df, ticker, latest_date)
```

***

### `cluster_summary()`

```python
def cluster_summary(df_mega)
```

***

### `feature_cent()`

```python
def feature_cent(df_mega, select_features = None)
```

***

### `vizualisation_cluster()`

```python
def vizualisation_cluster(df_mega)
```

***

### `vizualisation_scatter()`

```python
def vizualisation_scatter(df_mega)
```

***

### `vizualisation_animation()`

```python
def vizualisation_animation(df_mega)
```

***


---

# Agent Instructions: 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:

```
GET https://docs.sov.ai/api-reference/extensions/clustering.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
