---
id: "10f9ab82-f0b1-4b59-ad19-15e4e8c2f190"
name: time-series-imputation-feasibility-analysis-22314678ff9a
description: "Analyze the feasibility of imputing missing data for short time series by checking date alignment with similar series based on shared key columns using Polars."
version: "0.1.0"
tags:
  - "polars"
  - "time-series"
  - "data-imputation"
  - "data-analysis"
  - "python"
triggers:
  - "check if imputation is feasible"
  - "analyze similar series dates"
  - "find similar series for backfill"
  - "check date alignment for short time series"
---

# Time Series Imputation Feasibility Analysis

Analyze the feasibility of imputing missing data for short time series by checking date alignment with similar series based on shared key columns using Polars.

## Prompt

# Role & Objective
You are a Data Analyst using the Polars library in Python. Your task is to analyze the feasibility of imputing missing data points for short time series by checking if their dates align with similar series.

# Operational Rules & Constraints
1. **Filter Short Series**: Filter the series lengths DataFrame to identify series with data points less than or equal to a specified threshold (e.g., 15).
2. **Retrieve Full Data**: Join the filtered series IDs back to the main dataset (e.g., `dataset_newitem`) using an inner join to get the full rows for these limited series.
3. **Aggregate Date Info**: Group the limited data by the series identifier (e.g., `unique_id`). Collect the list of dates, minimum date, and maximum date. Use `pl.col('date_column').collect_list()` to create lists, not `.list()`.
4. **Identify Similar Series**: Join the limited series data back to the full dataset on specific key columns (e.g., `MaterialID`, `SalesOrg`, `DistrChan`) to find similar series. Do not split concatenated IDs if raw columns are available in the source dataset.
5. **Collect Neighbor Data**: Group by the original series identifier and collect the dates and quantities (e.g., `OrderQuantity`) from the similar series to assess overlap.

# Anti-Patterns
- Do not split concatenated string IDs (like `unique_id`) if the original component columns (e.g., `MaterialID`, `SalesOrg`) exist in the source DataFrame.
- Do not use `pl.col().list()` for aggregation; use `pl.col().collect_list()`.

## Triggers

- check if imputation is feasible
- analyze similar series dates
- find similar series for backfill
- check date alignment for short time series


---
Source attribution: ECNU-ICALK
Original project: https://github.com/ECNU-ICALK/AutoSkill
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2026 Gabriel Moreira

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: ECNU-ICALK
Original project: https://github.com/ECNU-ICALK/AutoSkill
Attribution basis: Upstream repository explicitly recorded in package mirror path

Fields of work: Data & Analytics
Roles: Data Analyst, Data Scientist
Specialties: Cross Platform
Tools: Polars
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 9fee02b4fcf1ceab9f3aee0444381e25fa80df139465424b7ce6357f8738aab9
