This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from PyQt5.QtWidgets import QApplication, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QPushButton, QWidget, QLineEdit, QMessageBox, QLabel | |
| class NestedDictManager(QApplication): | |
| def __init__(self, original_data): | |
| super(NestedDictManager, self).__init([]) | |
| self.original_data = original_data.copy() | |
| self.data = original_data.copy() | |
| self.tree = QTreeWidget() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %macro CalculTrimestre(dateDebutTrimestre); | |
| /* Format the dateDebutTrimestre variable as a date */ | |
| %let dateDebutTrimestre = %sysfunc(inputn(&dateDebutTrimestre, date9.)); | |
| /* Étape 1: Filtrer les clients dont l'anniversaire est dans le trimestre fourni */ | |
| proc sql; | |
| create table ClientsAnniversaire as | |
| select * | |
| from VotreTable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Taux_Variation_Produit = | |
| VAR Ventes_Semestre1 = CALCULATE(SUM('TableVentess'[Ventes]), 'TableVentess'[Semestre] = 1) | |
| VAR Ventes_Semestre2 = CALCULATE(SUM('TableVentess'[Ventes]), 'TableVentess'[Semestre] = 2) | |
| VAR Ventes_Produit = CALCULATE(SUM('TableVentess'[Ventes]), ALLEXCEPT('TableVentess', 'TableVentess'[Produit])) | |
| RETURN | |
| IF(ISBLANK(Ventes_Semestre1) || ISBLANK(Ventes_Semestre2) || Ventes_Semestre1 = 0, BLANK(), (Ventes_Semestre2 - Ventes_Semestre1) / Ventes_Produit) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Taux_Variation_MNE = | |
| CALCULATE( | |
| ( | |
| SUMX( | |
| VALUES('PBI'[MNE]), | |
| (CALCULATE(SUM('PBI'[Montant]), 'PBI'[Semestre] = 2) - | |
| CALCULATE(SUM('PBI'[Montant]), 'PBI'[Semestre] = 1)) / | |
| CALCULATE(SUM('PBI'[Montant]), 'PBI'[Semestre] = 1) | |
| ) | |
| ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Déclaration de la macro variable */ | |
| %let date_sas = '01JAN2023'd; | |
| /* Extraction de v1 */ | |
| data _null_; | |
| /* Conversion de la date en format numérique YYYYMM */ | |
| v1 = year(&date_sas.) * 100 + month(&date_sas.); | |
| call symputx('v1', v1); | |
| run; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| # Texte initial | |
| texte = 'prix\n100\nnombre\n2' | |
| # Diviser le texte en lignes | |
| lignes = texte.split('\n') | |
| # Initialiser des listes vides pour stocker les données | |
| colonnes = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| merged = pd.merge(df1, df2, on='C1', how='left') | |
| # Grouping by 'C1' and checking for multiple occurrences | |
| grouped = merged.groupby('C1') | |
| # Creating the new DataFrame with custom values for multiple occurrences | |
| df3 = pd.DataFrame(columns=merged.columns) | |
| for name, group in grouped: | |
| if len(group) > 1: | |
| df3 = df3.append({col: 'multiple' if col == 'C2' else 'MULTIPLE' for col in merged.columns}, ignore_index=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| df['col1'] = df['col1'].fillna(df['col2']) | |
| # --- 2. Prétraitement du DataFrame TV2 --- | |
| # On s'attend à ce que TV2 contienne les colonnes suivantes en MAJUSCULE : | |
| # PARTY_KEY, ROLE, PARTY_TYPE_CODE, RISQUE_SECTEUR, BASE_CURR_AMOUNT, etc. | |
| TV2['PARTY_TYPE_CODE'] = TV2['PARTY_TYPE_CODE'].astype(int) | |
| # Agrégation générale par PARTY_KEY pour les indicateurs financiers | |
| tv2_agg = TV2.groupby('PARTY_KEY').agg( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| from sklearn.ensemble import IsolationForest | |
| from sklearn.cluster import DBSCAN | |
| from sklearn.model_selection import train_test_split | |
| from sklearn.preprocessing import StandardScaler | |
| from tensorflow.keras.layers import Input, Dense | |
| from tensorflow.keras.models import Model | |
| from tensorflow.keras.callbacks import EarlyStopping | |
| import matplotlib.pyplot as plt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| from sklearn.ensemble import IsolationForest | |
| from sklearn.cluster import DBSCAN | |
| from sklearn.model_selection import train_test_split | |
| from sklearn.preprocessing import StandardScaler | |
| from sklearn.decomposition import PCA | |
| from tensorflow.keras.layers import Input, Dense | |
| from tensorflow.keras.models import Model | |
| from tensorflow.keras.callbacks import EarlyStopping |