Skip to content

Commit

Permalink
cập nhật cơ chế loại bỏ cột trùng trong BCTC
Browse files Browse the repository at this point in the history
  • Loading branch information
thinh-vu committed Oct 29, 2024
1 parent 5f767a9 commit 6f0e786
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ vnstock3/.DS_Store
vnstock3/.DS_Store
vnstock3/.DS_Store
docs/.DS_Store
dev/check_MSN_quarter_reports_df.xlsx
dev/MSN_quarter_reports_df.xlsx
8 changes: 7 additions & 1 deletion vnstock3/explorer/vci/financial.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,17 @@ def _ratio_mapping (self, ratio_df:pd.DataFrame, lang:Optional[str]='en', show_l
# Create a dictionary to map field_name to report type
mapping_df = self._get_ratio_dict(get_all=False)
# Filter the mapping DataFrame based on company type code. Split mapping into two parts: 'CT' and company-specific mapping
mapping_specific = mapping_df[mapping_df['com_type_code'] == self.com_type_code]
if self.com_type_code != 'CT':
mapping_specific = mapping_df[mapping_df['com_type_code'] == self.com_type_code]
else:
mapping_specific = pd.DataFrame()
mapping_ct = mapping_df[mapping_df['com_type_code'] == 'CT']
all_columns_mapping = pd.concat([mapping_specific, mapping_ct]).drop_duplicates(subset='field_name', keep='first')
all_columns_mapping = self.duplicated_columns_handling(all_columns_mapping, target_col_name=target_col_name)

# remove all values that com_type_code is not 'CT' or self.com_type_code
all_columns_mapping = all_columns_mapping[all_columns_mapping['com_type_code'].isin(['CT', self.com_type_code])].copy()

# # Filter the mapping DataFrame based on company type code. Split mapping into two parts: 'CT' and company-specific mapping
# mapping_specific = mapping_df[mapping_df['com_type_code'] == self.com_type_code]
# mapping_ct = mapping_df[mapping_df['com_type_code'] != self.com_type_code]
Expand Down

0 comments on commit 6f0e786

Please sign in to comment.