Skip to content

Instantly share code, notes, and snippets.

View karlafej's full-sized avatar

Karla Fejfarová karlafej

  • Imper s.r.o.
  • Prague
View GitHub Profile
@simecek
simecek / example.r
Created August 18, 2017 11:04
Classification of jpg files into several one letter subfolders
# example of usage
setwd("c:/Users/simecekp/Downloads/")
fls <- dir(patter=".*jpg")
jpg_sort(fls,c("a", "s"))
import cv2
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import NearestNeighbors
#from scipy.optimize import leastsq
from scipy.optimize import fmin_bfgs
from scipy.optimize import minimize
from scipy.optimize import approx_fprime
def res(p,src,dst):
@jlln
jlln / separator.py
Last active November 9, 2023 19:59
Efficiently split Pandas Dataframe cells containing lists into multiple rows, duplicating the other column's values.
def splitDataFrameList(df,target_column,separator):
''' df = dataframe to split,
target_column = the column containing the values to split
separator = the symbol used to perform the split
returns: a dataframe with each entry for the target column separated, with each element moved into a new row.
The values in the other columns are duplicated across the newly divided rows.
'''
def splitListToRows(row,row_accumulator,target_column,separator):
split_row = row[target_column].split(separator)