title_wip

```
ds['next_month'] = ds['date'].dt.add_months(1)
ds['last_week'] = ds['date'].dt.subtract_weeks(1)
```

### Boolean Checks[​](#dt-checks "Direct link to Boolean Checks")

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method Description|  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `is_month_start()` First day of month|  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `is_month_end()` Last day of month|  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `is_quarter_start()` First day of quarter|  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | | `is_quarter_end()` Last day of quarter|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `is_year_start()` First day of year|  |  |  |  | | --- | --- | --- | --- | | `is_year_end()` Last day of year|  |  | | --- | --- | | `is_leap_year()` Leap year | | | | | | | | | | | | | | | |

```
ds['is_eom'] = ds['date'].dt.is_month_end()
```

### Formatting[​](#dt-formatting "Direct link to Formatting")

|  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method ClickHouse Description|  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `strftime(fmt)` `formatDateTime()` Format as string|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `day_name()` - Day name|  |  |  | | --- | --- | --- | | `month_name()` - Month name | | | | | | | | | | | |

```
ds['date_str'] = ds['date'].dt.strftime('%Y-%m-%d')
ds['day_name'] = ds['date'].dt.day_name()
```

### Timezone[​](#dt-timezone "Direct link to Timezone")

|  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method ClickHouse Description|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `tz_convert(tz)` `toTimezone()` Convert timezone|  |  |  | | --- | --- | --- | | `tz_localize(tz)` - Localize timezone | | | | | | | | |

```
ds['utc_time'] = ds['timestamp'].dt.tz_convert('UTC')
```

---

## Array Accessor (`.arr`)[​](#arr "Direct link to arr")

ClickHouse-specific array operations (37 methods).

### Properties[​](#arr-properties "Direct link to Properties")

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Property ClickHouse Description|  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `length` `length()` Array length|  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `size` `length()` Alias for length|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `empty` `empty()` Is empty|  |  |  | | --- | --- | --- | | `not_empty` `notEmpty()` Is not empty | | | | | | | | | | | | | | |

```
ds['tag_count'] = ds['tags'].arr.length
ds['has_tags'] = ds['tags'].arr.not_empty
```

### Element Access[​](#arr-access "Direct link to Element Access")

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method ClickHouse Description|  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `array_first()` `arrayElement(..., 1)` First element|  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `array_last()` `arrayElement(..., -1)` Last element|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `array_element(n)` `arrayElement()` Nth element|  |  |  | | --- | --- | --- | | `array_slice(off, len)` `arraySlice()` Slice array | | | | | | | | | | | | | | |

```
ds['first_tag'] = ds['tags'].arr.array_first()
ds['last_tag'] = ds['tags'].arr.array_last()
```

### Aggregations[​](#arr-aggregations "Direct link to Aggregations")

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method ClickHouse Description|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `array_sum()` `arraySum()` Sum of elements|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `array_avg()` `arrayAvg()` Average|  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `array_min()` `arrayMin()` Minimum|  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `array_max()` `arrayMax()` Maximum|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `array_product()` `arrayProduct()` Product|  |  |  | | --- | --- | --- | | `array_uniq()` `arrayUniq()` Count unique | | | | | | | | | | | | | | | | | | | | |

```
ds['total'] = ds['values'].arr.array_sum()
ds['average'] = ds['values'].arr.array_avg()
```

### Transformations[​](#arr-transformations "Direct link to Transformations")

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method ClickHouse Description|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `array_sort()` `arraySort()` Sort ascending|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `array_reverse_sort()` `arrayReverseSort()` Sort descending|  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `array_reverse()` `arrayReverse()` Reverse order|  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `array_distinct()` `arrayDistinct()` Unique elements|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `array_compact()` `arrayCompact()` Remove consecutive dupes|  |  |  | | --- | --- | --- | | `array_flatten()` `arrayFlatten()` Flatten nested | | | | | | | | | | | | | | | | | | | | |

```
ds['sorted_tags'] = ds['tags'].arr.array_sort()
ds['unique_tags'] = ds['tags'].arr.array_distinct()
```

### Modifications[​](#arr-modifications "Direct link to Modifications")

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method ClickHouse Description|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `array_push_back(elem)` `arrayPushBack()` Add to end|  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `array_push_front(elem)` `arrayPushFront()` Add to front|  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `array_pop_back()` `arrayPopBack()` Remove last|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `array_pop_front()` `arrayPopFront()` Remove first|  |  |  | | --- | --- | --- | | `array_concat(other)` `arrayConcat()` Concatenate | | | | | | | | | | | | | | | | | |

### Search[​](#arr-search "Direct link to Search")

|  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method ClickHouse Description|  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `has(elem)` `has()` Contains element|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `index_of(elem)` `indexOf()` Find index|  |  |  | | --- | --- | --- | | `count_equal(elem)` `countEqual()` Count occurrences | | | | | | | | | | | |