eshan6704 commited on
Commit
36176df
·
verified ·
1 Parent(s): ee66395

Update build_index_live_html.py

Browse files
Files changed (1) hide show
  1. build_index_live_html.py +20 -5
build_index_live_html.py CHANGED
@@ -16,8 +16,14 @@ def build_index_live_html(name=""):
16
  if not const_df.empty:
17
  const_df = const_df.iloc[:, 1:] # Remove first column
18
 
19
- # Drop unnecessary columns
20
- drop_cols = [
 
 
 
 
 
 
21
  "identifier", "ffmc", "stockIndClosePrice", "lastUpdateTime",
22
  "chartTodayPath", "chart30dPath", "chart365dPath", "series",
23
  "symbol_meta", "activeSeries", "debtSeries", "isFNOSec",
@@ -25,7 +31,16 @@ def build_index_live_html(name=""):
25
  "tempSuspendedSeries", "isETFSec", "isDelisted",
26
  "slb_isin", "isMunicipalBond", "isHybridSymbol", "QuotePreOpenFlag"
27
  ]
28
- const_df = const_df.drop(columns=[c for c in drop_cols if c in const_df.columns])
 
 
 
 
 
 
 
 
 
29
 
30
  # Ensure pChange is numeric and sort
31
  if 'pChange' in const_df.columns:
@@ -69,7 +84,7 @@ def build_index_live_html(name=""):
69
  # ================= METRIC TABLES =================
70
  metric_cols = [
71
  "pChange", "totalTradedValue", "nearWKH", "nearWKL",
72
- "perChange365d", "perChange30d", "listingDate"
73
  ]
74
 
75
  metric_tables = ""
@@ -146,7 +161,7 @@ th {{
146
  background: #f0a8a8; /* light red */
147
  }}
148
 
149
- /* ==================== Fixed row height & clipping for Constituent Table ==================== */
150
  #constituents-table tr, #constituents-table td {{
151
  max-height: 25px;
152
  height: 25px;
 
16
  if not const_df.empty:
17
  const_df = const_df.iloc[:, 1:] # Remove first column
18
 
19
+ # Columns to move from constituents to info
20
+ move_to_info = [c for c in ['segment', 'equityTime', 'preOpenTime'] if c in const_df.columns]
21
+ if move_to_info:
22
+ rem_df = pd.concat([rem_df, const_df[move_to_info].iloc[[0]]], axis=1)
23
+ const_df = const_df.drop(columns=move_to_info)
24
+
25
+ # Drop unnecessary columns from Constituents
26
+ drop_cols_const = [
27
  "identifier", "ffmc", "stockIndClosePrice", "lastUpdateTime",
28
  "chartTodayPath", "chart30dPath", "chart365dPath", "series",
29
  "symbol_meta", "activeSeries", "debtSeries", "isFNOSec",
 
31
  "tempSuspendedSeries", "isETFSec", "isDelisted",
32
  "slb_isin", "isMunicipalBond", "isHybridSymbol", "QuotePreOpenFlag"
33
  ]
34
+ const_df = const_df.drop(columns=[c for c in drop_cols_const if c in const_df.columns])
35
+
36
+ # Drop unnecessary columns from Main Data
37
+ drop_cols_main = [
38
+ "series", "symbol_meta", "companyName", "industry", "activeSeries", "debtSeries",
39
+ "isFNOSec", "isCASec", "isSLBSec", "isDebtSec", "isSuspended", "tempSuspendedSeries",
40
+ "isETFSec", "isDelisted", "isin", "slb_isin", "listingDate", "isMunicipalBond",
41
+ "isHybridSymbol", "segment", "equityTime", "preOpenTime", "QuotePreOpenFlag"
42
+ ]
43
+ main_df = main_df.drop(columns=[c for c in drop_cols_main if c in main_df.columns])
44
 
45
  # Ensure pChange is numeric and sort
46
  if 'pChange' in const_df.columns:
 
84
  # ================= METRIC TABLES =================
85
  metric_cols = [
86
  "pChange", "totalTradedValue", "nearWKH", "nearWKL",
87
+ "perChange365d", "perChange30d"
88
  ]
89
 
90
  metric_tables = ""
 
161
  background: #f0a8a8; /* light red */
162
  }}
163
 
164
+ /* Fixed row height & clipping for Constituent Table */
165
  #constituents-table tr, #constituents-table td {{
166
  max-height: 25px;
167
  height: 25px;