Skip to content

Instantly share code, notes, and snippets.

# Function to find interdependent product groups
def find_interdependent_groups(transactions):
product_groups = []
remaining_products = set()
# Get unique products
for products in transactions:
remaining_products |= products
transactions_copy = transactions.copy() # Create a copy of the list
def populate_tree(tree, item, dictionary):
if isinstance(dictionary, dict):
for key, value in dictionary.items():
if isinstance(value, dict):
sub_item = tree.insert(item, "end", text=key)
populate_tree(tree, sub_item, value)
else:
tree.insert(item, "end", text=key, values=(value,))
else:
tree.insert(item, "end", values=(dictionary,))
import xlrd
# Open the workbook
workbook = xlrd.open_workbook('your_excel_file.xls')
# Select the first sheet
sheet = workbook.sheet_by_index(0)
# Iterate through rows and columns to read data
for row in range(sheet.nrows):
%let folder_path = "your_folder_path"; /* Specify the path to your folder */
%let table_name = "xyz"; /* Specify the table name to search for */
/* Create a fileref for the directory */
filename dirlist "&folder_path" ;
/* Get a list of SAS program files in the folder */
data sas_files;
length file_name $256.;
infile dirlist truncover;
@hdary85
hdary85 / 2.py
Last active November 9, 2023 04:21
import win32com.client
import pandas as pd
import io
from datetime import datetime
# Connect to Outlook
outlook = win32com.client.Dispatch("Outlook.Application")
namespace = outlook.GetNamespace("MAPI")
# Recherche du dossier principal par son nom
import random
def jeu_de_devinette():
nombre_a_deviner = random.randint(1, 20)
essais = 0
print("Bienvenue dans le jeu de devinette !")
print("Je pense à un nombre entre 1 et 20.")
while True:
with open('your_file.txt', 'r') as file:
paragraphs = file.read().split('$')
# Remove leading and trailing whitespace from each paragraph
paragraphs = [p.strip() for p in paragraphs]
# Remove duplicates while preserving order
unique_paragraphs = []
seen = set()