영상에서 X_train 데이터 결측치 처리 하실 때 X_train['workclass'] = X_train['workclass'].fillna(X_train['workclass'].mode()[0]) X_train['native.country'] = X_train['native.country'].fillna(X_train['native.country'].mode()[0]) X_train['occupation'] = X_train['occupation'].fillna('X') 이렇게 해주셨는데 m1 = X_train['workclass'].mode()[0] m2 = X_train['native.country'].mode()[0] X_train['workclass'] = X_train['workclass'].fillna(m1) X_train['native.country'] = X_train['native.country'].fillna(m2) X_train['occupation'] = X_train['occupation'].fillna('X') 이렇게 저만의 방식으로 기호 만들어서 활용해도 되나요?
안녕하세요 ! 수업 들으면서 열심히 실기 준비하고 있습니다 섹션5. 라이브러리 및 데이터 불러오기 강의에서 #상관관계 코드를 입력할 때 아래와 같이 뜨는데 corr(numeric_only=True) 형식으로 바뀐건가요?? # 상관관계 X_train.corr() # 판다스 버전이 최신으로 변경될 경우 에러 발생할 수 있습니다. 아래와 같이 numeric_only=True를 사용해주세요! sum(), mean()등도 모두 포함 # X_train.corr(numeric_only=True)
강의에서는 수치형 변수 스케일링 부분을 cols = [ 수치형 변수들] 변수 선언 후에 적용하셨는데 제 생각에는 이미 그 위에서 n_train, c_train, n_test, c_test 로 구분해 놓았기 때문에 불필요하다 생각해서 아래와 같이 작성했는데, 오류가 발생합니다. 왜그러는 걸까요? from sklearn.preprocessing import RobustScaler scaler = RobustScaler() n_train = scaler.fit_transform(n_train) n_test = scaler.transform(n_test) n_train.head() #오류내용 AttributeError: 'numpy.ndarray' object has no attribute 'head'
어떤 가상 환경인지 환경 이름에 드러나게 작성해주는게 좋습니다. 변수명 작성할때도 a, b, 이렇게 하는 것 보다 name, age, 이런 식으로 의미를 명확히 담아서 만드는게 코드 유지보수하기 좋잖아요? 나중에 가상환경들이 많아졌을 때, 환경 이름이 venv, venv1, venv2, 이런식으로 되어 있는 것과, django_test_venv, flask_py310_env, streamlit_llm_chatbot_py311_venv 등으로 되어있는 것 중 어떤게 더 사용이 편할지 생각해보시면 되겠습니다. 이 강의도 그렇고 인터넷 보면 죄다 예제가 venv로 만드는 것으로 되어있는데 현업에서 이렇게 하다가 개고생하고 드리는 말씀이니 참고하세요...
spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/oauthdb?useSSL=false username: root password: jinwook219 jpa: database: mysql # InnoDB?? database-platform: org.hibernate.dialect.MySQL8Dialect generate-ddl: true hibernate: ddl-auto: create show_sql: true jwt: # 32글자 이상 인코딩된 문자열 : oauthserversecretaccesstokenoauthserversecretaccesstokenoauthserversecretaccesstoken secret: b2F1dGhzZXJ2ZXJzZWNyZXRhY2Nlc3N0b2tlbm9hdXRoc2VydmVyc2VjcmV0YWNjZXNzdG9rZW5vYXV0aHNlcnZlcnNlY3JldGFjY2Vzc3Rva2Vu expiration: 3000 #분단위 package com.example.oauth.auth; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import javax.crypto.spec.SecretKeySpec; import java.security.Key; import java.util.Date; @Component public class JwtTokenProvider { private final String secretKey; private final int expiration; private Key SECRET_KEY; public JwtTokenProvider(@Value("${jwt.secret}") String secretKey, @Value("${jwt.expiration}") int expiration) { this.secretKey = secretKey; this.expiration = expiration; this.SECRET_KEY = new SecretKeySpec(java.util.Base64.getDecoder().decode(secretKey), SignatureAlgorithm.HS512.getJcaName()); } public String createToken(String email, String role){ // claims는 jwt토큰의 payload부분을 의미 Claims claims = Jwts.claims().setSubject(email); claims.put("role", role); Date now = new Date(); String token = Jwts.builder() .setClaims(claims) .setIssuedAt(now) .setExpiration(new Date(now.getTime()+ expiration*60*1000L)) .signWith(SECRET_KEY) .compact(); return token; } } Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2025-04-29T00:35:55.742+09:00 ERROR 3891 --- [ main] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtTokenProvider' defined in file [/Users/macforjinwook/Desktop/oauth/build/classes/java/main/com/example/oauth/auth/JwtTokenProvider.class]: Unexpected exception during bean creation at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:536) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:339) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:347) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:337) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.DefaultListableBeanFactory.instantiateSingleton(DefaultListableBeanFactory.java:1155) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingleton(DefaultListableBeanFactory.java:1121) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:1056) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:987) ~[spring-context-6.2.5.jar:6.2.5] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:627) ~[spring-context-6.2.5.jar:6.2.5] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.4.4.jar:3.4.4] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) ~[spring-boot-3.4.4.jar:3.4.4] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-3.4.4.jar:3.4.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:318) ~[spring-boot-3.4.4.jar:3.4.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1361) ~[spring-boot-3.4.4.jar:3.4.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350) ~[spring-boot-3.4.4.jar:3.4.4] at com.example.oauth.OauthApplication.main(OauthApplication.java:10) ~[main/:na] Caused by: org.springframework.util.PlaceholderResolutionException: Could not resolve placeholder 'jwt.secret' in value "${jwt.secret}" at org.springframework.util.PlaceholderResolutionException.withValue(PlaceholderResolutionException.java:81) ~[spring-core-6.2.5.jar:6.2.5] at org.springframework.util.PlaceholderParser$ParsedValue.resolve(PlaceholderParser.java:423) ~[spring-core-6.2.5.jar:6.2.5] at org.springframework.util.PlaceholderParser.replacePlaceholders(PlaceholderParser.java:128) ~[spring-core-6.2.5.jar:6.2.5] at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:118) ~[spring-core-6.2.5.jar:6.2.5] at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:114) ~[spring-core-6.2.5.jar:6.2.5] at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:255) ~[spring-core-6.2.5.jar:6.2.5] at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:226) ~[spring-core-6.2.5.jar:6.2.5] at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:201) ~[spring-context-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:971) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1577) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1555) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:913) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:240) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1381) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1218) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:563) ~[spring-beans-6.2.5.jar:6.2.5] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523) ~[spring-beans-6.2.5.jar:6.2.5] ... 16 common frames omitted 종료 코드 1(으)로 완료된 프로세스 Caused by: org.springframework.util.PlaceholderResolutionException: Could not resolve placeholder 'jwt.secret' in value "${jwt.secret}" 이 부분을 보면 yml에 있는 jwt.secret을 인식 못하는 것 같은데 원인을 못 찾겠습니다 강사님 깃허브 코드를 붙혀넣어봐도 왜 이런지 잘 모르겠습니다. 혹시 이런 경우에는 어떤 것을 찾아봐야하나요??
과거에 파이썬을 배울때 df[출력행][조건] 이런식으로 배워서 익숙한데 2회 기출유형(작업형1) 3번 문제 마지막은 df[조건][출력행] 으로 되어 있어 궁금한 점이 있습니다. 순서는 상관이 없는건가요? 전 아래와 같이 코딩했고 결과값은 같습니다. print(df['age'][cond1|cond2].sum())
강의에서는 name, host_name, last_review, host_id를 삭제하고 reviews_per_month는 0으로 대체했습니다. 근데 예를 들어 이 문제가 시험에 출제되었다면, 강의처럼 똑같이 해야 점수를 획득하는건가요? 다른 컬럼들을 더 삭제하거나 위에 컬럼들 중 일부를 삭제하지 않으면 점수가 깎이는건가요?
에어플로우 설치 중 오류가 발생해 오랜시간동안 재시도해보다가 질문 드립니다.! 아래의 오류들에 대한 원인이 무엇일지, 그리고 어떻게 해결해야 할지 궁금합니다. 1. sudo docker compose up airflow-init 해당 코드 실행 중 'The container is run as root user. For security, consider using a regular user account.' 라는 알림이 나오며, 사용자-airflow-init-1 이 아닌 airflow-init-1로 뜹니다. sudo docker compose up 해당 코드 실행 중 'airflow-apiserver-1 is unhealthy'라는 오류가 발생합니다. (이 문제로 도커 초기화 및 재설치부터 고유한 user secret key 입력 등 여러번 시도했으나, 동일한 오류가 계속 반복됩니다.) 참고로, sudo docker compose up 코드 실행 중 다음과 같은 오류들이 주로 보입니다. airflow-apiserver-1 | ValueError: The value api_auth/jwt_secret must be set! airflow-apiserver-1 | ERROR: Application startup failed. Exiting. airflow-apiserver-1 | ERROR: Traceback (most recent call last): airflow-apiserver-1 | INFO: Child process [3223] died