validate_column_names¶
yohou.utils.validate_column_names(df)
¶
Validate that __ separator is used only for panel data group names.
The __ separator is reserved for panel data groups following the pattern
Parameters ¶
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
DataFrame to validate. |
required |
Raises ¶
| Type | Description |
|---|---|
ValueError
|
If any column name contains __ but doesn't match the group pattern, or if __ appears multiple times in inconsistent way. |
Examples ¶
>>> import polars as pl
>>> # Valid: no __ separator
>>> df = pl.DataFrame({"time": [1, 2], "value": [10, 20]})
>>> validate_column_names(df) # No error
>>> # Valid: proper group pattern
>>> df = pl.DataFrame({"time": [1, 2], "sales__store_1": [100, 110]})
>>> validate_column_names(df) # No error
>>> # Invalid: __ without proper pattern
>>> df = pl.DataFrame({"time": [1, 2], "my__bad__col": [10, 20]})
>>> validate_column_names(df)
Traceback (most recent call last):
...
ValueError: Column 'my__bad__col' contains multiple __ separators...
See Also ¶
check_inputs : Validates time intervals and calls this function
Source Code ¶
Source code in src/yohou/utils/validation.py
924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | |