Skip to content

Instantly share code, notes, and snippets.

@hdary85
hdary85 / gui22
Created November 30, 2023 04:26
import tkinter as tk
from tkinter import simpledialog, messagebox
class NestedDictManager:
def __init__(self, root, data):
self.root = root
self.root.title("Nested Dictionary Manager")
self.data = data # Use the provided dictionary
self.tree = tk.ttk.Treeview(self.root)
@hdary85
hdary85 / COMBI.PY
Last active December 1, 2023 21:18
# Liste de tous les produits uniques
all_products = set(df['PRODUIT'])
# Grouper les produits achetés par CLIENT
grouped = df.groupby('CLIENT')['PRODUIT'].apply(set)
# Générer toutes les combinaisons de 3 à 5 produits
unique_combos = []
used_products = set()
data resultats;
set votre_table;
array colonnes[*] col1-col20;
terme1_present = 0;
terme2_present = 0;
terme3_present = 0;
do i = 1 to dim(colonnes);
@hdary85
hdary85 / Nlp.py
Last active December 6, 2023 07:18
Nlp.py
import pandas as pd
import spacy
# Charger le modèle spaCy pour le traitement du langage naturel (fr_core_news_sm est un modèle léger pour le français)
nlp = spacy.load('fr_core_news_sm')
# Charger le fichier CSV dans un dataframe
df = pd.read_csv('votre_fichier.csv')
# Charger le fichier texte
@hdary85
hdary85 / Diflib.py
Last active December 6, 2023 08:12
import pandas as pd
from difflib import SequenceMatcher
import csv
import re
# Charger le fichier CSV dans un dataframe
df = pd.read_csv('votre_fichier.csv')
# Charger le fichier texte
with open('votre_fichier.txt', 'r', encoding='utf-8') as file:
import os
import psutil
def get_files_in_use(directory):
files_in_use = set()
# Iterate through all files in the directory and its subdirectories
for root, dirs, files in os.walk(directory):
for file in files:
file_path = os.path.join(root, file)
%macro Calculs_Trimestriels(trimestre);
/* Début de la macro */
/* Extraction des informations nécessaires de la table */
data TempData;
set NOM_TABLE;
format DateDepot datetime27.6;
trimestre_date = intnx('quarter', input(put(&trimestre., yymmn6.), yymmn6.), 0, 'b');
run;
@hdary85
hdary85 / Streamlit
Last active January 23, 2024 00:21
# Save the Streamlit code in a separate file, e.g., my_streamlit_app.py
# my_streamlit_app.py
import streamlit as st
def update_nested_dict(nested_dict, keys, new_value):
current_dict = nested_dict
for key in keys[:-1]:
current_dict = current_dict[key]
current_dict[keys[-1]] = new_value
@hdary85
hdary85 / Widget
Created January 23, 2024 00:54
Widget
import ipywidgets as widgets
from IPython.display import display
def update_nested_dict(nested_dict, keys, new_value):
current_dict = nested_dict
for key in keys[:-1]:
current_dict = current_dict[key]
current_dict[keys[-1]] = new_value
def display_and_update_widgets(nested_dict):
@hdary85
hdary85 / widg2
Last active January 23, 2024 01:45
import ipywidgets as widgets
from IPython.display import display
class NestedDictManagerJupyter:
def __init__(self, original_data):
self.original_data = original_data
self.data = original_data.copy()
self.accordion = widgets.Accordion(selected_index=None)
self.accordion.observe(self.update_selected_item, names='selected_index')