카테고리 없음2023. 12. 21. 08:55
QSlider::groove:horizontal {
border: 1px solid #bbb;
background: white;
height: 10px;
border-radius: 4px;
}

QSlider::sub-page:horizontal {
background: qlineargradient(x1: 0, y1: 0,    x2: 0, y2: 1,
    stop: 0 #66e, stop: 1 #bbf);
background: qlineargradient(x1: 0, y1: 0.2, x2: 1, y2: 1,
    stop: 0 #bbf, stop: 1 #55f);
border: 1px solid #777;
height: 10px;
border-radius: 4px;
}

QSlider::add-page:horizontal {
background: #fff;
border: 1px solid #777;
height: 10px;
border-radius: 4px;
}

QSlider::handle:horizontal {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
    stop:0 #eee, stop:1 #ccc);
border: 1px solid #777;
width: 13px;
margin-top: -2px;
margin-bottom: -2px;
border-radius: 4px;
}

QSlider::handle:horizontal:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
    stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}

QSlider::sub-page:horizontal:disabled {
background: #bbb;
border-color: #999;
}

QSlider::add-page:horizontal:disabled {
background: #eee;
border-color: #999;
}

QSlider::handle:horizontal:disabled {
background: #eee;
border: 1px solid #aaa;
border-radius: 4px;
}
Posted by 오늘보다 나은 내일
카테고리 없음2022. 5. 13. 10:00

import pandas as pd
df = pd.DataFrame([80,90,70,50,40],columns=['mathVal'])
df['Grade'] =list(map(lambda x: "A" if (x >=90) else ("B" if (x >=80) else ("C" if (x >=70) else "D")),df.mathVal))

print(df)
Posted by 오늘보다 나은 내일
카테고리 없음2022. 4. 15. 10:17

map, reduce, filter..

 

 

score = lambda x: "A등급" if x >= 80 else ("B등급" if x >= 70 else "C등급")

 

# ----------------------------------------------------------

add = lambda a, b: a+b
result = add(3, 5) 

 

# ----------------------------------------------------------

arr = [[1,2,9],
       [5,1,8],
       [3,7,9]]
# 2열이 가장 큰 행 
print(max(arr, key=lambda x: x[1]))   # [3,7,9]
# 2열이 가장 큰 행의 3번째 요소
print(max(arr, key=lambda x: x[1])[2])   # 9

 

# ----------------------------------------------------------

a = [1, 6, 2, 5, 2, 7, 2, 8, 9, 11, 5, 26]
result = list(map(lambda x : x**2, a))  # 제곱시키기
print(result)
result2 = list(map(lambda x : str(x) if x % 2 == 0 else x, a))   # 짝수인 것은 string 타입으로 cast 아니면 단순히 반환
print(result2)

b = [12, 16, 24, 5, 20, 27, 12, 8, 9, 110, 51, 26]
result3 = list(map(lambda x, y : x + y, a, b))  # 리스트 자료형 두 개 받아서 연산
print(result3)

# ----------------------------------------------------------

full_name = lambda first, last: f'Full name: {first.title()} {last.title()}'
full_name('Fname', 'Name')
 

# ----------------------------------------------------------

def square(x):
    return lambda : x*x

listOfLambdas = [square(i) for i in [1,2,3,4,5]]
for f in listOfLambdas:
    print(f())

listOfLambdas = [lambda i=i: i*i for i in range(1, 6)]
for f in listOfLambdas:
   print(f())

 

 

 

Posted by 오늘보다 나은 내일