ltc-code 0.1.86__tar.gz → 0.1.87__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ltc-code
3
- Version: 0.1.86
3
+ Version: 0.1.87
4
4
  Summary: Add your description here
5
5
  Requires-Python: >=3.9
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ltc-code"
3
- version = "0.1.86"
3
+ version = "0.1.87"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.9"
@@ -0,0 +1,63 @@
1
+ from typing import Union, List
2
+ import polars as pl
3
+
4
+
5
+ FINAL_APPS_SCHEMA = [
6
+ "cmo_name",
7
+ "cmo_region",
8
+ "ren_num",
9
+ "sid_cepr",
10
+ "school_name",
11
+ "school_set",
12
+ "school_year",
13
+ "entry_grade_clean",
14
+ "school_accept",
15
+ "offer",
16
+ "initial_offer",
17
+ "waitlist_offer",
18
+ "priority_group",
19
+ "priority_group_name",
20
+ "risk_id",
21
+ "birth_cohort",
22
+ "age",
23
+ "enroll",
24
+ "offer_accepted",
25
+ "enroll_years",
26
+ "enroll_school",
27
+ "withdraw",
28
+ "application_cancel",
29
+ "waitlist",
30
+ "waitlist_number",
31
+ "lottery_number",
32
+ "late_app",
33
+ "offer_date",
34
+ "application_date",
35
+ "sibling",
36
+ "staff",
37
+ "zoned",
38
+ ]
39
+
40
+
41
+
42
+ def keep_final_apps_schema(
43
+ df: Union[pl.DataFrame, pl.LazyFrame],
44
+ ) -> Union[pl.DataFrame, pl.LazyFrame]:
45
+
46
+ cols = (
47
+ df.columns
48
+ if isinstance(df, pl.DataFrame)
49
+ else df.collect_schema().names()
50
+ )
51
+
52
+ keep_cols = [
53
+ col for col in FINAL_APPS_SCHEMA
54
+ if col in cols
55
+ ]
56
+
57
+ return df.select(keep_cols)
58
+
59
+
60
+ df = (
61
+ df
62
+ .pipe(keep_final_apps_schema)
63
+ )
File without changes