DavMelchi commited on
Commit
6d5dd85
·
1 Parent(s): 7209b6d

convert code to int and replace empty to 0 code

Browse files
Files changed (1) hide show
  1. queries/process_lte.py +60 -2
queries/process_lte.py CHANGED
@@ -31,6 +31,40 @@ LNCEL_COLUMNS = [
31
  ]
32
 
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  LNCEL_FDD_COLUMNS = [
35
  "ID_LNCEL",
36
  "dlChBw",
@@ -54,7 +88,7 @@ LNCEL_TDD_COLUMNS = [
54
  ]
55
 
56
 
57
- def process_lte_data(file_path: str):
58
  """
59
  Process data from the specified file path.
60
 
@@ -64,7 +98,7 @@ def process_lte_data(file_path: str):
64
  # Read excel sheets into dataframes
65
  dfs = pd.read_excel(
66
  file_path,
67
- sheet_name=["LNCEL", "LNBTS", "LNCEL_FDD", "LNCEL_TDD"],
68
  engine="calamine",
69
  skiprows=[0],
70
  )
@@ -74,6 +108,9 @@ def process_lte_data(file_path: str):
74
  df_lncel.columns = df_lncel.columns.str.replace(r"[ ]", "", regex=True)
75
  df_lncel["final_name"] = df_lncel["name"].fillna(df_lncel["cellName"])
76
  df_lncel["code"] = df_lncel["final_name"].str.split("_").str[0]
 
 
 
77
  df_lncel["SectorId"] = (
78
  df_lncel["lcrId"].map(UtilsVars.sector_mapping).fillna(df_lncel["lcrId"])
79
  )
@@ -93,6 +130,27 @@ def process_lte_data(file_path: str):
93
  df_lncel["Region"] = df_lncel["final_name"].str.split("_").str[1]
94
  df_lncel["band"] = df_lncel["final_name"].apply(get_band)
95
  df_lncel["band_type"] = np.where(df_lncel["band"] == "L2300", "TDD", "FDD")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  df_lncel = df_lncel[LNCEL_COLUMNS]
97
 
98
  # create band dataframe
 
31
  ]
32
 
33
 
34
+ LNCEL_MOBILITY_COLUMNS = [
35
+ "ID_LNBTS",
36
+ "ID_LNCEL",
37
+ "MRBTS",
38
+ "LNBTS",
39
+ "LNCEL",
40
+ "final_name",
41
+ "name",
42
+ "cellName",
43
+ "code",
44
+ "SectorId",
45
+ "Code_Sector",
46
+ "administrativeState",
47
+ "lcrId",
48
+ "band",
49
+ "band_type",
50
+ "a3Offset",
51
+ "enableBetterCellHo",
52
+ "enableCovHo",
53
+ "threshold3",
54
+ "threshold3a",
55
+ "threshold4",
56
+ "threshold2InterFreq",
57
+ "threshold2Wcdma",
58
+ "threshold2a",
59
+ "threshold1",
60
+ "hysThreshold2InterFreq",
61
+ "hysThreshold2Wcdma",
62
+ "hysThreshold2a",
63
+ "hysThreshold3",
64
+ "hysThreshold4",
65
+ ]
66
+
67
+
68
  LNCEL_FDD_COLUMNS = [
69
  "ID_LNCEL",
70
  "dlChBw",
 
88
  ]
89
 
90
 
91
+ def process_lncel(file_path: str):
92
  """
93
  Process data from the specified file path.
94
 
 
98
  # Read excel sheets into dataframes
99
  dfs = pd.read_excel(
100
  file_path,
101
+ sheet_name=["LNCEL"],
102
  engine="calamine",
103
  skiprows=[0],
104
  )
 
108
  df_lncel.columns = df_lncel.columns.str.replace(r"[ ]", "", regex=True)
109
  df_lncel["final_name"] = df_lncel["name"].fillna(df_lncel["cellName"])
110
  df_lncel["code"] = df_lncel["final_name"].str.split("_").str[0]
111
+ df_lncel["code"] = (
112
+ pd.to_numeric(df_lncel["code"], errors="coerce").fillna(0).astype(int)
113
+ )
114
  df_lncel["SectorId"] = (
115
  df_lncel["lcrId"].map(UtilsVars.sector_mapping).fillna(df_lncel["lcrId"])
116
  )
 
130
  df_lncel["Region"] = df_lncel["final_name"].str.split("_").str[1]
131
  df_lncel["band"] = df_lncel["final_name"].apply(get_band)
132
  df_lncel["band_type"] = np.where(df_lncel["band"] == "L2300", "TDD", "FDD")
133
+
134
+ return df_lncel
135
+
136
+
137
+ def process_lte_data(file_path: str):
138
+ """
139
+ Process data from the specified file path.
140
+
141
+ Args:
142
+ file_path (str): The path to the file.
143
+ """
144
+ # Read excel sheets into dataframes
145
+ dfs = pd.read_excel(
146
+ file_path,
147
+ sheet_name=["LNBTS", "LNCEL_FDD", "LNCEL_TDD"],
148
+ engine="calamine",
149
+ skiprows=[0],
150
+ )
151
+
152
+ # Get LNCEL data
153
+ df_lncel = process_lncel(file_path)
154
  df_lncel = df_lncel[LNCEL_COLUMNS]
155
 
156
  # create band dataframe