728x90
728x90

Python Selenium


from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(ChromeDriverManager().install())
os.makedirs(path, exist_ok=True)

이미지 저장

urlretrieve

JPA


  1. 연관관계가 있는 데이터 변경시에는 기존에 데이터가 있는지 확인하자
  2. @MappedSuperClass abstract
  3. @AttributeOverride,@AttributeOverrides
  4. @AssociationOverride,@AssociationOverrides
  5. 식별자, 비식별자
  6. @IdClass
  7. @EmbeddedId / implements Serializable / method equals / method hasCode Override / Noargs Constructor / public
  8. @JoinColumns / referenceedColumnName
  9. 조인 컬럼 / 조인 테이블
  10. 즉시 로딩 fetch = FetchType.EAGER / 지연 로딩 fetch = FetchType.LAZY
  11. inner join : nullable =false or ManyToOne Option = false <=> outer join : nullable = true
  12. 영속성 전이 : CASCADE
  13. CASCADE TYPE : ALL,PERSIST,MERGE,REMOVE,DETACH,REFRESH
  14. 고아객체 : ORPHAN : orphanRemoval = true
  15. Embedded Type => @Embeddable
  16. 값 타입 불변과 객체
  17. Embedded 값 타입 복사
  18. 값 타입 컬렉션 : @ElementCollection
  19. JPQL
  20. fetch 조인 : join fetch
  21. queryDSL
  22. 벌크연산
728x90

'개발일기' 카테고리의 다른 글

[TIL#11]  (0) 2023.06.13
[TIL#10]  (0) 2023.06.12
[TIL#9]  (2) 2023.06.09
[TIL#7]  (0) 2023.06.02
[TIL #4]  (0) 2023.05.03
728x90
from datetime import date
from dateutil.relativedelta import relativedelta

today = date.today()

print(today)

sub_date = today - relativedelta(years=2)

print(sub_date)

 

728x90
728x90

Trie는 문자열 검색 알고리즘 중 하나로, 문자열을 저장하고 검색하는 데 유용합니다.

이진 탐색 트리와 달리, Trie는 문자열을 저장하는 트리 자료구조입니다.

Trie의 각 노드가 문자열의 한 문자에 대응되는 것입니다.

Trie를 이용해 문자열을 빠르게 검색 할 수 있습니다.

검색을 수행할 문자열을 루트에서 시작해 각 문자에 해당하는 노드들을 따라 검색을 합니다.

class Node:
    def __init__(self,text):
        self.text = text
        self.last = 0
        self.child = {}
        
class Trie:
    
    def __init__(self):
        self.no = 0
        self.root = Node(None)
    
    def add(self,text):
        currentNode = self.root
        for t in text:
            if t not in currentNode.child:
                self.no +=1
                currentNode.child[t] = Node(t)
                print(f"ADD : {t} || Current No. : {self.no}")
            currentNode = currentNode.child[t]
        currentNode.last = 1
        print(f"TOTAL : {self.no}")
        
    def find(self,text):
        result = ""
        currentNode = self.root
        for t in text:
            if t in currentNode.child:
                result += t
                currentNode = currentNode.child[t]
        return result
728x90
728x90

텐서플로우 인덱스 참조

- 텐서의 인덱스 참조도 넘파이와 유사

 

1차원 인덱싱

- 1차원 텐서 만들기 

>>> t = tf.constant([1,2,3,])
>>> t

<tf.Tensor: shape=(3,), dtype=int32, numpy=array([1, 2, 3], dtype=int32)>

- 인덱싱

>>> t[:2]
<tf.Tensor: shape=(2,), dtype=int32, numpy=array([1, 2], dtype=int32)>

 

2차원 인덱싱

- 2차원 텐서만들기

>>> t = tf.constant([[1,2,3],[4,5,6]])
>>> t

<tf.Tensor: shape=(2, 3), dtype=int32, numpy=
array([[1, 2, 3],
       [4, 5, 6]], dtype=int32)>

- 2차원 인덱싱

>>> t[:1]

<tf.Tensor: shape=(1, 3), dtype=int32, numpy=array([[1, 2, 3]], dtype=int32)>

>>> t[:,2]

<tf.Tensor: shape=(2,), dtype=int32, numpy=array([3, 6], dtype=int32)>

>>> t[:2,:2]

<tf.Tensor: shape=(2, 2), dtype=int32, numpy=
array([[1, 2],
       [4, 5]], dtype=int32)>

 

3차원 인덱싱

- 3차원 텐서만들기

>>> t = tf.constant([[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]]])
>>> t

<tf.Tensor: shape=(2, 2, 3), dtype=int32, numpy=
array([[[ 1,  2,  3],
        [ 4,  5,  6]],

       [[ 7,  8,  9],
        [10, 11, 12]]], dtype=int32)>

- 3차원 인덱싱

>>> t[:2,1:,:2]

<tf.Tensor: shape=(2, 1, 2), dtype=int32, numpy=
array([[[ 4,  5]],

       [[10, 11]]], dtype=int32)>
728x90

'Development Study > tensorflow' 카테고리의 다른 글

[tensorflow] 텐서플로우 - 텐서 만들기 #1  (0) 2021.03.10
728x90

tf.constant()

 

- tf.constant() 함수로 텐서를 만들 수 있음

tf.constant(value, dtype=None, shape=None, name='Const')

 

이것저것 해보기

 

import tensorflow as tf

>>> tf.constant([1,2,3,])

<tf.Tensor: shape=(3,), dtype=int32, numpy=array([1, 2, 3], dtype=int32)>

- dtype 지정

>>> tf.constant([1,2,3],dtype=float)

<tf.Tensor: shape=(3,), dtype=float32, numpy=array([1., 2., 3.], dtype=float32)>

- shape 지정

- value의 shape 에 맞춰서 지정

>>> tf.constant([1,2,3],dtype=float,shape=(3,1))

<tf.Tensor: shape=(3, 1), dtype=float32, numpy=
array([[1.],
       [2.],
       [3.]], dtype=float32)>

 

 

728x90
728x90
728x90

+ Recent posts