inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

172만명의 커뮤니티!! 함께 토론해봐요.

http://localhost:3000/api/auth/session 500에러

미해결

Next + React Query로 SNS 서비스 만들기

안녕하세요 선생님 로컬에서 locallhost:3000/api/auth를 호출하면 500에러가 발생합니다. * 참고: 1. useSession()은 모두 클라이언트 컴포넌트에만 적용했습니다. 2. 원인을 찾아보다가 예전 선생님 답변해주신 서버 컴포넌트에서 세션props로 받아스라고 하신거 참고해서 그렇게 수정해도 동일하게 발생합니다. 3. 비슷한 질문에 쿠키랑 다 없앤뒤 잘됐다는것도 보고 다제거해봤지만 동일하게 발생했습니다. 4. .next, node_module 다 제거후 새로 깔거나, 빌드를 새로 하거나 테스트도 해보았습니다. 5. 브라우저 껐다키고, 컴퓨터 재부팅도 해보았습니다. 6. 선생님의 깃코드를 가져다 쓰기도 해보았습니다. 빌드 한후에 npm run start로 했을땐 정상적으로 나오는데 로컬에서만 발생합니다. /src/auth.ts import NextAuth from "next-auth" import Credentials from "next-auth/providers/credentials" export const { handlers, signIn, signOut, auth } = NextAuth({ pages: { signIn: '/login', newUser: '/signup', }, providers: [ Credentials({ credentials: { id: {}, password: {}, }, authorize: async (credentials) => { try { const authResponse = await fetch(`${process.env.NEXT_PUBLIC_BASE_URL}/api/login`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(credentials), }) console.log(authResponse.ok, '-----------------------------authResponse.ok'); if (!authResponse.ok) { return null; } let user = await authResponse.json(); console.log(user, '--------------------------------'); return { ...user, email: user.id, name: user.nickname, image: user.image, } } catch (err) { console.error('로그인 에러', err); } }, }), ], }) .env AUTH_SECRET=WKFOJhbw7gZOYXumT66CwwKtDZ9YsalV8qMRx134Uc8= AUTH_TRUST_HOST=http://localhost:3000 .env.local NEXT_PUBLIC_API_MOCKING=enabled NEXT_PUBLIC_MODE=local NEXT_PUBLIC_BASE_URL=http://localhost:9090 NEXTAUTH_URL=http://localhost:3000 /src/app/layout.tsx import type { Metadata, Viewport } from "next"; import { Inter } from "next/font/google"; import "./globals.css"; import { MSWComponent } from './_component/MSWComponent'; import AuthSession from './_component/AuthSession'; const inter = Inter({ subsets: ["latin"] }); export const metadata: Metadata = { title: { template: '%s | MBTI', default: 'MBTI가 어떻게 되세요?', }, description: "MBTI로 찾는 내 연인", }; export const viewport: Viewport = { width: 'device-width', initialScale: 1, maximumScale: 1, userScalable: false, // Also supported by less commonly used // interactiveWidget: 'resizes-visual', } export default function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { return ( <html lang="en"> <body className={`${inter.className} antialiased`}> <MSWComponent /> <AuthSession> {children} </AuthSession> </body> </html> ); } /src/app/_component 'use client'; import { SessionProvider } from 'next-auth/react'; import { ReactNode } from 'react'; export default function AuthSession({children}: {children: ReactNode}) { return ( <SessionProvider>{children}</SessionProvider> ) } /src/app/api/auth/[...nextauth]/route.ts import { handlers } from "@/auth" // Referring to the auth.ts we just created export const { GET, POST } = handlers; 폴더구조 📦src ┣ 📂app ┃ ┣ 📂(afterLogin) ┃ ┃ ┣ 📂(home) ┃ ┃ ┃ ┣ 📂_component ┃ ┃ ┃ ┃ ┣ 📜mbtiCarousel.module.css ┃ ┃ ┃ ┃ ┣ 📜MbtiCarousel.tsx ┃ ┃ ┃ ┃ ┗ 📜UserCardList.tsx ┃ ┃ ┃ ┗ 📂_lib ┃ ┃ ┃ ┃ ┗ 📜getUserAll.ts ┃ ┃ ┣ 📂@modal ┃ ┃ ┃ ┣ 📂(.)promise ┃ ┃ ┃ ┃ ┗ 📂form ┃ ┃ ┃ ┃ ┃ ┗ 📜page.tsx ┃ ┃ ┃ ┣ 📂[userId] ┃ ┃ ┃ ┃ ┣ 📂_component ┃ ┃ ┃ ┃ ┃ ┣ 📜UserDetailContent.tsx ┃ ┃ ┃ ┃ ┃ ┣ 📜UserDetailPromise.tsx ┃ ┃ ┃ ┃ ┃ ┣ 📜UserDetailTop.tsx ┃ ┃ ┃ ┃ ┃ ┣ 📜UserInfo.tsx ┃ ┃ ┃ ┃ ┃ ┗ 📜UsrCarousel.tsx ┃ ┃ ┃ ┃ ┣ 📂_lib ┃ ┃ ┃ ┃ ┃ ┣ 📜getAUser.ts ┃ ┃ ┃ ┃ ┃ ┗ 📜getUserPromise.ts ┃ ┃ ┃ ┃ ┗ 📜page.tsx ┃ ┃ ┃ ┗ 📜default.tsx ┃ ┃ ┣ 📂like ┃ ┃ ┃ ┣ 📂_component ┃ ┃ ┃ ┃ ┣ 📜LikeCard.tsx ┃ ┃ ┃ ┃ ┣ 📜LikeTabProvider.tsx ┃ ┃ ┃ ┃ ┣ 📜Tab.tsx ┃ ┃ ┃ ┃ ┣ 📜TabDecider.tsx ┃ ┃ ┃ ┃ ┣ 📜UserILike.tsx ┃ ┃ ┃ ┃ ┗ 📜UserLikeMe.tsx ┃ ┃ ┃ ┣ 📂_lib ┃ ┃ ┃ ┃ ┣ 📜getUserILike.ts ┃ ┃ ┃ ┃ ┗ 📜getUserLikeMe.ts ┃ ┃ ┃ ┗ 📜page.tsx ┃ ┃ ┣ 📂messages ┃ ┃ ┃ ┗ 📜page.tsx ┃ ┃ ┣ 📂profile ┃ ┃ ┃ ┗ 📜page.tsx ┃ ┃ ┣ 📂promise ┃ ┃ ┃ ┣ 📂form ┃ ┃ ┃ ┃ ┗ 📜page.tsx ┃ ┃ ┃ ┣ 📂_component ┃ ┃ ┃ ┃ ┣ 📜PromiseCard.tsx ┃ ┃ ┃ ┃ ┣ 📜PromiseCardDropdown.tsx ┃ ┃ ┃ ┃ ┣ 📜PromiseCardLink.tsx ┃ ┃ ┃ ┃ ┣ 📜PromiseFormButton.tsx ┃ ┃ ┃ ┃ ┣ 📜promiseSection.module.css ┃ ┃ ┃ ┃ ┗ 📜PromiseSection.tsx ┃ ┃ ┃ ┣ 📂_lib ┃ ┃ ┃ ┃ ┗ 📜getPromiseAll.ts ┃ ┃ ┃ ┗ 📜page.tsx ┃ ┃ ┣ 📂recommend ┃ ┃ ┃ ┣ 📂_component ┃ ┃ ┃ ┃ ┗ 📜RecommendSection.tsx ┃ ┃ ┃ ┣ 📂_lib ┃ ┃ ┃ ┃ ┗ 📜getUserRecommends.ts ┃ ┃ ┃ ┣ 📜page.tsx ┃ ┃ ┃ ┗ 📜recommend.module.css ┃ ┃ ┣ 📂search ┃ ┃ ┃ ┣ 📂_component ┃ ┃ ┃ ┃ ┣ 📜SearchCard.tsx ┃ ┃ ┃ ┃ ┣ 📜SearchForm.tsx ┃ ┃ ┃ ┃ ┗ 📜SearchResult.tsx ┃ ┃ ┃ ┣ 📂_lib ┃ ┃ ┃ ┃ ┗ 📜getSearchResult.ts ┃ ┃ ┃ ┗ 📜page.tsx ┃ ┃ ┣ 📂setting ┃ ┃ ┃ ┗ 📜page.tsx ┃ ┃ ┣ 📂[userId] ┃ ┃ ┃ ┗ 📜page.tsx ┃ ┃ ┣ 📂_component ┃ ┃ ┃ ┣ 📜Back.tsx ┃ ┃ ┃ ┣ 📜ImageWithPlaceholder.tsx ┃ ┃ ┃ ┣ 📜LogoutButton.tsx ┃ ┃ ┃ ┣ 📜MainTitle.tsx ┃ ┃ ┃ ┣ 📜MbtiRecommendSection.tsx ┃ ┃ ┃ ┣ 📜Modal.tsx ┃ ┃ ┃ ┣ 📜RQProvider.tsx ┃ ┃ ┃ ┣ 📜SearchForm.tsx ┃ ┃ ┃ ┣ 📜userCard.module.css ┃ ┃ ┃ ┣ 📜UserCard.tsx ┃ ┃ ┃ ┣ 📜UserCardArticle.tsx ┃ ┃ ┃ ┗ 📜UserRandomRecommendSection.tsx ┃ ┃ ┣ 📂_lib ┃ ┃ ┃ ┣ 📜getBase64.ts ┃ ┃ ┃ ┗ 📜getUserRandomRecommends.ts ┃ ┃ ┣ 📜layout.module.css ┃ ┃ ┣ 📜layout.tsx ┃ ┃ ┗ 📜page.tsx ┃ ┣ 📂(beforeLogin) ┃ ┃ ┣ 📂login ┃ ┃ ┃ ┣ 📜login.module.css ┃ ┃ ┃ ┗ 📜page.tsx ┃ ┃ ┣ 📂signup ┃ ┃ ┃ ┣ 📜page.tsx ┃ ┃ ┃ ┗ 📜signup.module.css ┃ ┃ ┣ 📂userSetting ┃ ┃ ┃ ┣ 📂_component ┃ ┃ ┃ ┃ ┣ 📜BirthdaySelect.tsx ┃ ┃ ┃ ┃ ┣ 📜DrinkSelect.tsx ┃ ┃ ┃ ┃ ┣ 📜GenderSelect.tsx ┃ ┃ ┃ ┃ ┣ 📜ImageSelect.tsx ┃ ┃ ┃ ┃ ┣ 📜JobSelect.tsx ┃ ┃ ┃ ┃ ┣ 📜MbtiSelect.tsx ┃ ┃ ┃ ┃ ┣ 📜NicknameSelect.tsx ┃ ┃ ┃ ┃ ┣ 📜RegionSelect.tsx ┃ ┃ ┃ ┃ ┣ 📜ReligionSelect.tsx ┃ ┃ ┃ ┃ ┣ 📜SchoolSelect.tsx ┃ ┃ ┃ ┃ ┣ 📜SetUser.tsx ┃ ┃ ┃ ┃ ┣ 📜SetUser2.tsx ┃ ┃ ┃ ┃ ┣ 📜SetUserComplete.tsx ┃ ┃ ┃ ┃ ┣ 📜SetUserProvider.tsx ┃ ┃ ┃ ┃ ┣ 📜SetUserProvider2.tsx ┃ ┃ ┃ ┃ ┣ 📜SetUserTop.tsx ┃ ┃ ┃ ┃ ┣ 📜SmokeSelect.tsx ┃ ┃ ┃ ┃ ┗ 📜TallSelect.tsx ┃ ┃ ┃ ┣ 📜page.tsx ┃ ┃ ┃ ┗ 📜userSetting.module.css ┃ ┃ ┣ 📂_component ┃ ┃ ┃ ┣ 📜title.module.css ┃ ┃ ┃ ┗ 📜Title.tsx ┃ ┃ ┗ 📂_lib ┃ ┃ ┃ ┗ 📜login.ts ┃ ┣ 📂api ┃ ┃ ┗ 📂auth ┃ ┃ ┃ ┗ 📂[...nextauth] ┃ ┃ ┃ ┃ ┗ 📜route.ts ┃ ┣ 📂_component ┃ ┃ ┣ 📜AuthSession.tsx ┃ ┃ ┣ 📜BottomNav.tsx ┃ ┃ ┣ 📜LeftNav.tsx ┃ ┃ ┣ 📜MSWComponent.tsx ┃ ┃ ┣ 📜nav.module.css ┃ ┃ ┗ 📜TopNav.tsx ┃ ┣ 📜favicon.ico ┃ ┣ 📜globals.css ┃ ┗ 📜layout.tsx ┣ 📂components ┃ ┗ 📂ui ┃ ┃ ┣ 📜avatar.tsx ┃ ┃ ┣ 📜badge.tsx ┃ ┃ ┣ 📜button.tsx ┃ ┃ ┣ 📜card.tsx ┃ ┃ ┣ 📜carousel.tsx ┃ ┃ ┣ 📜dropdown-menu.tsx ┃ ┃ ┣ 📜form.tsx ┃ ┃ ┣ 📜input.tsx ┃ ┃ ┣ 📜label.tsx ┃ ┃ ┣ 📜progress.tsx ┃ ┃ ┣ 📜skeleton.tsx ┃ ┃ ┣ 📜textarea.tsx ┃ ┃ ┗ 📜tooltip.tsx ┣ 📂lib ┃ ┗ 📜utils.ts ┣ 📂mocks ┃ ┣ 📜browser.ts ┃ ┣ 📜handlers.ts ┃ ┗ 📜http.ts ┣ 📂model ┃ ┣ 📜Post.ts ┃ ┣ 📜postImage.ts ┃ ┣ 📜User.ts ┃ ┗ 📜UserImage.ts ┣ 📜auth.ts ┗ 📜middleware.ts 로컬에서 잘되다가 어느순간부터 됐다 안됐다 하다가 이제는 안되고 있습니다. 어느 부분을 좀 더 찾아보고 해야할지 조언주시면 정말 감사하겠습니다.

  • react
  • next.js
  • react-query
  • next-auth
  • msw
챠챠_ 댓글 1 좋아요 0 조회수 931

devcontainer.json 수정 후 rebuild 관련 질문입니다.

해결됨

실전도커: 도커로 나만의 딥러닝 클라우드 컴퓨터 만들기

일방적인 수업이 아닌 양방향의 수업을 지향합니다. 게시판에서 질문을 적극적으로 활용하세요. (이해가 되실 때까지 지속적으로 질문을 던지시는 것이 중요합니다. 업무일 기준 2~3일 내에 답변을 드릴 수 있도록 최선을 다하겠습니다.) 다만, 질문이 이해될 수 있도록 (상식 수준에서), 다듬어 주세요. 게시판 공개가 어려운 경우에 메일로 연락주시길 요청 드립니다. (daniel@datatrain.education) 수업을 빠르게 한 번 쭉 들으신 후에, 한 번 더 학습하실 것을 권장드립니다. 안녕하세요 강사님 수업을 듣다가 궁금한 점이 있어 질문 드립니다. 수업을 들으면서 devcontainer.json를 생성하고 rebuild container를 하면 1. devcontainer.json의 "build" 정보를 이용하여 docker build 를 진행 docker run ~ 그 외 추가적인 과정 한다고 이해했습니다. 그리고 Dockerfile을 image로 만들 때, build를 하는 것으로 알고있습니다. 실습에서 Dockerfile과 json 파일에서 "build" 부분을 수정하지 않고, "runArgs", "customization" 을 추가했는데 build를 다시 해야하는 점이 이해가 가지 않습니다...ㅠㅠ devcontainer.json의 수정 사항을 적용하거나 실행하기 위해서는 build과정이 필요해서 그런 것 일까요?? 그리고 devcontainer.json을 수정하고 rebuild하면 container가 재생성이 되는 것인가요?? 또한 처음에 devcontainer.json 파일을 생성하고 New Dev Container 가 아닌 Rebuild container를 하는 이유도 궁급합니다. 감사합니다.

  • python
  • 딥러닝
  • linux
  • docker
  • azure
  • 가상화
  • mlops
붕붕 댓글 2 좋아요 1 조회수 299

2회 기출유형(작업형1) 문제2번

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

문제2 주어진 데이터셋(members.csv)의 앞에서부터 순서대로 80% 데이터만 활용해 'f1'컬럼 결측치를 중앙값으로 채우기 전 후의 표준편차를 구하고, 두 표준편차 차이 계산하기 (단, 표본표준편차 기준, 두 표준편차 차이는 절대값으로 계산) 풀이 # your code df = pd.read_csv("members.csv") # df.shape df1 = df.loc[:79] df1.isnull().sum() # print(df1.describe()) bf = 20.574853 # print(df1.head()) # print(df1.isnull().sum()) df1['f1'] = df1['f1'].fillna(df1['f1'].median()) # print(df1.isnull().sum()) # print(df1.head()) # print(df1.describe()) af = 17.010789 print(bf-af) 이런식으로 describe함수에서 나오는 값으로 풀었는데 실제 시험에서도 이렇게 문제를 풀어도 상관없을까요?? 영상에서 풀이한 값과 소수점 자리가 다르더라구요..

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
since4042 댓글 1 좋아요 0 조회수 167

pred[:,1] 완벽 구별법

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

실제로 시험이 나올때pred[:,1]를 무작정 쓰면 큰일날것 같습니다.어떨때는 pred[:,1]을 쓰고 어떨때는pred[:,0]을 쓰는게 맞는지 알려주시면 감사하겠습니다.단순히 분류값이 0일 확률에 대한건 pred[:,0], 1에 대한건 pred[:,1]로 보는게 맞는건가요?

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
빅분기가자 댓글 2 좋아요 0 조회수 359

작업형 2번 문제에서 '결측치'가 있을 때의 처리방법

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

작업형 2번에서 '결측치'가 있다면 그 결측치들을 삭제하고 진행시키는 게 좋을까요? 아니면 그 결측치들을 전부 0으로 채우는 게 나을까요? 혹시 이렇게 그냥 아예 결측치 컬럼을 삭제하거나 0으로 채워도 40점이 나올 수 있을까요.? ㅠ

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
성욱 댓글 1 좋아요 0 조회수 192

prefetchQuery 적용 후 Warning: Text content did not match. 오류가 발생합니다.

해결됨

Next + React Query로 SNS 서비스 만들기

안녕하세요. 강의 잘 보고 있습니다.!! 👍 👍 react-query를 적용 중 오류가 표시되어 오류와 궁금한 부분이 있어서 문의 드립니다. Text content did not match. 오류가 발생하는데 어느 부분이 문제인지 잘 모르겠습니다 ㅠㅠ prefetchQuery 를 사용하여 서버에서 post(트윗)데이터를 프리패치 후 TweetList컴포넌트에서 useQuery 를 사용하게 만들었습니다. Post의 데이터는 msw에서 알려주신 faker를 통해서 요청마다 content를 동적으로 생성하게 했구요. 콘솔로 출력한 데이터와 reactQuery개발 도구의 데이터는 동일한데 화면에 표기된 데이터는 전혀 다른 데이터로 표시되네요.. 그리고 방식이 prefetchQuery 를 사용한 데이터는 staleTime과 상관없이 Fresh상태로 되어 useQuery 호출 시 데이터가 아직 fresh한 상태이므로 서버를 호출하지 않고 캐쉬에서 가져와 보여주는 방식이 맞나요? 오류로그 app-index.js:33 Warning: Text content did not match. Server: "Tener adulatio decens conitor. Thesis apostolus ago at decerno. Iste uberrime commodo. Verus amitto quas cometes delicate. Cognomen alii curto ciminatio. Solitudo complectus tristis. Teneo sum vindico. Adhuc decimus triumphus ipsa arguo umquam addo adulatio cresco. Sponte degenero non trado cauda beneficium laboriosam approbo." Client: "Tremo collum sint terror templum summisse viduo usque unus benevolentia. Eligendi substantia concido amissio uredo turpis aperte. Admoneo titulus audeo conicio fuga." at div at div at div at article at TweetWrapper (webpack-internal:///(app-pages-browser)/./src/app/(afterLogin)/home/_components/TweetWrapper.tsx:11:11) at Tweet (webpack-internal:///(app-pages-browser)/./src/app/(afterLogin)/home/_components/Tweet.tsx:31:11) at TweetList (webpack-internal:///(app-pages-browser)/./src/app/(afterLogin)/home/_components/TweetList.tsx:16:93) at HydrationBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/@tanstack+react-query@5.39.0_react@18.2.0/node_modules/@tanstack/react-query/build/modern/HydrationBoundary.js:14:11) at HomeContextProvider (webpack-internal:///(app-pages-browser)/./src/app/(afterLogin)/home/_components/Provider.tsx:17:11) at InnerLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/layout-router.js:242:11) at RedirectErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/redirect-boundary.js:74:9) at RedirectBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/redirect-boundary.js:82:11) at NotFoundBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/not-found-boundary.js:84:11) at LoadingBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/layout-router.js:340:11) at ErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/error-boundary.js:162:11) at InnerScrollAndFocusHandler (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/layout-router.js:152:9) at ScrollAndFocusHandler (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/layout-router.js:227:11) at RenderFromTemplateContext (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/render-from-template-context.js:16:44) at OuterLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/layout-router.js:359:11) at InnerLayoutRouter (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/layout-router.js:242:11) at RedirectErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/redirect-boundary.js:74:9) at RedirectBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/redirect-boundary.js:82:11) at NotFoundBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/not-found-boundary.js:84:11) at LoadingBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/layout-router.js:340:11) at ErrorBoundary (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/error-boundary.js:162:11) at InnerScrollAndFocusHandler (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/next@14.1.4_@babel+core@7.24.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/client/components/layout-router.js:152:9) at ScrollAndFocu 소스코드 (Tweet이 Post입니다! 나중에 바꿔야겠네여) [page.tsx] /home import React from "react"; import HomeTopTab from "./_components/HomeTopTab"; import WriteForm from "./_components/WriteForm"; import TweetList from "./_components/TweetList"; import HomeContextProvider from "./_components/Provider"; import { QueryClient, dehydrate, HydrationBoundary, } from "@tanstack/react-query"; import getPostRecommends from "./_lib/getPostRecommends"; const HomePage = async () => { const queryClient = new QueryClient(); await queryClient.prefetchQuery({ queryKey: ["tweet", "recommends"], queryFn: getPostRecommends, }); const dehydratedState = dehydrate(queryClient); return ( <HomeContextProvider> <HomeTopTab /> <WriteForm /> <HydrationBoundary state={dehydratedState}> <TweetList /> </HydrationBoundary> </HomeContextProvider> ); }; export default HomePage; TweetList.tsx "use client"; import React from "react"; import Tweet from "./Tweet"; import getPostRecommends from "../_lib/getPostRecommends"; import { Post } from "./TweetWrapper"; import { QueryClient, useQuery } from "@tanstack/react-query"; const TweetList = () => { const { data: tweets } = useQuery<Post[]>({ queryKey: ["tweet", "recommends"], queryFn: getPostRecommends, enabled: false, }); console.log("🚀 _ TweetList _ tweets:", tweets); return tweets?.map((tweet) => <Tweet post={tweet} key={tweet.postId} />); }; export default TweetList;

  • react
  • next.js
  • react-query
  • next-auth
  • msw
홍홍 댓글 2 좋아요 0 조회수 477

검증데이터 분리 질문

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

검증데이터를 분리할때 X_tr, X_val 은 (909, 12) (161,12) 로 열이 12인데 y_tr, y_val 은 왜 열값이 안나오는지 궁금합니다. 이 질문에 대한 답변을 받았는데 답변이 이해가 안가서 재질문합니다~ 이해하기 쉽게 설명이 더 추가될수 있을까요? 받은답변 : 와우! 정확히 보셨어요! 거기에 만약 1이 적히면 데이터프레임이 됩니다. 모델 학습시 타겟이 데이터프레임으로 들어가면 워닝이나 에러가 발생할 수 있어요. 시리즈라서 열값이 나오지 않습니다.

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
crystal 댓글 1 좋아요 0 조회수 225

선생님 마지막 공부법 질문요!

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

머리식힐겸 유튜브 채널에 있는 강의도 1~2개 봤는데 유형 바뀌기 전에 강의들이라... 현재 수강하고 있는 강의 위주로 복습하는게 맞겠죠!? 바쁘신데 공부법 질문만 올려서 죄송합니다 ㅠ

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
moonwrd 댓글 1 좋아요 0 조회수 210

작업형1모의문제1 - 문제3 질문

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! 질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요 먼저 유사한 질문이 있었는지 검색해보세요 문제3의 변환 과정에서 아래와 같이 코드를 짜도 문제 없는건가요? 결과값은 동일합니다. df['f3'] = df['f3'].fillna(0) df['f3'] = df['f3'].replace('silver', 1).replace('gold', 2).replace('vip', 3) 그리고 pandas에서 sum을 1번처럼 작성하는걸 더 권장한다고 들었는데 어떤 차이가 있는 건가요? 1. print(df['f3'].sum()) 2. print(sum(df['f3']))

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
종버 댓글 2 좋아요 0 조회수 186

stratify 설정 질문

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

선생님 강의 잘 듣고 있습니다. 다름이 아니라 예전에 혼자 공부할 때 데이터 분할을 할 때 stratify를 설정해서 데이터 불균형을 처리한다고 들었는데, 제가 놓친 것일 수도 있지만 선생님 강의에서는 따로 이에 관한 설명을 본 적이 없어서 질문드립니다. 2유형을 푸는 데에 있어서 stratify는 굳이 설정을 안 해도 문제가 없을까요? 아니면 시험 볼 때 설정을 해놓는 게 더 좋을까요?

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
댓글 2 좋아요 0 조회수 262

문제 2번 의사결정나무 오류

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

강사님 요거 왜 오류걸리는걸까요, 어제 문제 1번까지 듣고 오늘 다시 강의들어서 그런걸까 싶어서 이전 셀 실행까지 해보고 오탈자 검수도 계속하는데, 다음 단계로 넘어가지않아요ㅠㅠ 원래 이렇게 어렵나용.. 비전공자라 그럴 수 있다고 생각되지만 너무 어렵네요..ㅠㅠ

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
연뚜 댓글 3 좋아요 0 조회수 261

너무 간단한건데 이해가 안됩니다 ㅠㅠ 정말 간단합니다.. 정규화

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

일단 이 문제는 캐글에서 선생님께서 생성해주신 문제구요. T1-9 수치형 변수 표준화 문제입니다. from sklearn.preprocessing import StandardScaler scaler = StandardScaler() df['f5']=scaler.fit_transform(df[['f5']]) df.head() 요렇게 해야 한다고 했는데요 저는 세번째 줄을 df['f5'] = scaler.fit _transform(df['f5']) 로 했는데 오류가 나서 잘 보니까, transform 뒤에 df[['f5']] 로 답이 작성되어 있더라고요 여기는 왜 []를 두번씩 감싸는 건가요????

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
져니 댓글 2 좋아요 1 조회수 249

작업형1모의문제1 - 문제2 질문

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! 질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요 먼저 유사한 질문이 있었는지 검색해보세요 문제2의 세번째 조건이 "컬럼의 'gold' 값을 가진 데이터 수를 출력하세요!"라고 나와 있습니다. 강의에서는 아래 코드와 같이 sum으로 풀이해주셨는데 , sum 대신 len으로 작성해도 동일한 결과가 나옵니다. sum이나 len 어떤 걸 사용해도 상관없는 건지 궁금합니다. 데이터 수이기 때문에 len이 더 정확한 답일까요? print(sum(df[df['f3'] == 'gold']))

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
종버 댓글 2 좋아요 0 조회수 221

작업형 1 모의문제 풀어보기(1-2)

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

컬럼별 행별 합산할때 axis=1을 썼는데 axis =0은 행방향, axis=1은 열방향으로 알고 있었는데 제가 잘못알고 있는걸까요? #위가 맞다면 행별 합산이니 axis =0으로 해야하는거 아닌가 해서 어떤 차이가 있나 궁금해 문의 드려요.

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
92200607 댓글 1 좋아요 1 조회수 157

향후공부법 ㅠㅠㅠ

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

선생님... 강의 들으면서 따라 치고는 있는데 점점 뒤로갈수록 설명이 짧고 다 알고 있다는 전제하에 툭툭 넘어가시는건지 모르는것도 많고 ㅠ 이런 방법 저런 방법 알려주시려고 하다보니 제 머리속에서 엉키는데... 남은 강의 들으면서 어떻게 준비해야할까요?

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
moonwrd 댓글 1 좋아요 0 조회수 243

50프로 수강중입니다~

미해결

실습으로 끝장내는 웹 크롤링과 웹 페이지 자동화 & 실전 활용

현재 50프로 수강을 하면 진짜 많은 도움 받고 있습니다. 감사합니다. 네이버 플레이스를 크롤링하려다 보니 json형태로 정보를 받을 수 있더라고요. 이런 경우는 어떻게 크롤링하고 파싱하는지 알 수 있을까요?...

  • python
  • 웹-크롤링
  • selenium
  • beautifulsoup
thehohyeon 댓글 1 좋아요 0 조회수 248

json정보를 주는 사이트 크롤링 방법

미해결

[신규 개정판] 이것이 진짜 크롤링이다 - 실전편 (인공지능 수익화)

강의 너무 재밌고 유익하게 완강하였습니다. 감사합니다~ ^^ 제가 네이버 플레이스에서 맛집을 추출하려고 하는데 json형태로 제공이 되는데 json형태로 제공되는 사이트를 크롤링하고 데이터를 파싱하는 방법은 강의 내용에는 없던데 어떻게 하면 좋을까요? ㅠㅠ 혹시 강의를 추가해주실수도 있을까요?

  • python
  • 웹-크롤링
thehohyeon 댓글 1 좋아요 0 조회수 219

찜하기 관련 질문드립니다.

미해결

Next + React Query로 SNS 서비스 만들기

안녕하세요 상세페이지에서 찜하기 요청을 하게되면 users/favorite/${peopleId}로 post 요청을 보내게되고 그럼 users/favorite api에 찜한 사람들의 목록이 추가됩니다. 찜하기를 눌렀을경우 아이콘의 컬러를 변경시켜야해서 getQueryData로 찜한 사람들의 목록 을 가져오려고 하였는데 const { data: likePeopleList } = useQuery<GetPeoples>({ queryKey: ["get", "likepeoples"], queryFn: getLikePeoples, staleTime: 60 * 1000, // fresh -> stale, 5분이라는 기준 gcTime: 300 * 1000, }); 위에 코드가 없으면 likeQuery를 가져오지 못하고있는것같습니다. getQueryData로 가져오는 방법이 잘못된걸까요? 다른 좋은 방법있다면 여쭤보고싶습니다. 밑에는 전체 코드입니다. type Props = { peopleId: string; }; export default function PeoplePosts({ peopleId }: Props) { const { data } = useQuery< GetPeoplePost, Object, GetPeoplePost, [_1: string, _2: string, _3: string] >({ queryKey: ["get", "peoplesDetail", peopleId], queryFn: getPeopleDetail, }); const { data: likePeopleList } = useQuery<GetPeoples>({ queryKey: ["get", "likepeoples"], queryFn: getLikePeoples, staleTime: 60 * 1000, // fresh -> stale, 5분이라는 기준 gcTime: 300 * 1000, }); const { content, nickname, userFileUrl, favoriteCount, viewCount, softSkill, techStack, links, position, alarmStatus, year, } = data?.data ?? {}; const queryClient = useQueryClient(); const likeQuery = queryClient.getQueryData<GetPeoples>([ "get", "likepeoples", ]); console.log("likeQuery", likeQuery); const liked = !!likeQuery?.data.find( (item) => item.userId === Number(peopleId), ); console.log("liked", liked); const like = useMutation({ mutationFn: (peopleId: string) => { return fetch( `${process.env.NEXT_PUBLIC_BASE_URL}/users/favorite/${peopleId}`, { method: "post", }, ); }, onMutate(peopleId: string) { const oldData = queryClient.getQueryData<GetPeoples>([ "get", "likepeoples", ]); if (oldData) { const newData = { ...oldData, data: oldData.data.map((item) => ({ ...item, userId: Number(peopleId), })), }; queryClient.setQueryData(["get", "likepeoples"], newData); } }, }); const unLike = useMutation({ mutationFn: (peopleId: string) => { return fetch( `${process.env.NEXT_PUBLIC_BASE_URL}/users/favorite/${peopleId}`, { method: "delete", }, ); }, onMutate(peopleId: string) { const oldData = queryClient.getQueryData<GetPeoples>([ "get", "likepeoples", ]); if (oldData) { const deleteData = { ...oldData, data: oldData.data.filter((item) => item.userId !== Number(peopleId)), }; queryClient.setQueryData(["get", "likepeoples"], deleteData); } }, }); const onLike: MouseEventHandler<HTMLButtonElement> = (e) => { e.preventDefault(); if (liked) { unLike.mutate(peopleId); } else { like.mutate(peopleId); } }; return ( <div className="flex flex-col"> <div className="flex flex-col gap-4 border-b pb-10"> <div className="flex items-center gap-[10px]"> <Image src={`${userFileUrl}`} alt="유저프로필" width={30} height={30} /> <h1 className="text-[32px] font-bold">{nickname}</h1> <div> <BlueTextBox textSize="12px" textToShow={`${position}`} /> </div> </div> <div className="flex flex-col gap-2"> {softSkill ?.split(",") .map((skill, i) => <HashTag text={skill} key={i} />)} </div> <div className="flex gap-3"> <HeartEyeIconBox count={favoriteCount as number} icon={heartIcon} /> <HeartEyeIconBox count={viewCount as number} icon={eyeIcon} /> </div> </div> <div className="mt-[42px] flex flex-col gap-[50px]"> <div className="people-post-grid"> <h1 className="text-[22px] font-bold">경력</h1> <h3>{year}</h3> </div> <div className="people-post-grid"> <h1 className="text-[22px] font-bold">사용언어</h1> <div className="flex gap-2"> {techStack ?.split(",") .map((stack, i) => ( <TechStack techStack={stack} showText key={`stack${i}`} /> ))} </div> </div> <div className="flex flex-col gap-3"> <h1 className="text-[22px] font-bold">자기소개</h1> <p>{content}</p> </div> <div className="flex flex-col gap-3"> <h1 className="text-[22px] font-bold">Link</h1> <Link href={links as string}>{links}</Link> </div> </div> <div className="mt-[60px] flex gap-[13px] self-center"> <button className={`h-[58px] w-[142px] rounded-md bg-neutral-orange-500 font-bold ${alarmStatus ? "text-neutral-white-0" : "text-neutral-black-800"}`} > {alarmStatus ? "제안하기" : "제안불가"} </button> <button onClick={onLike} className="flex h-[58px] w-[58px] flex-col items-center justify-center rounded-md border" > {liked ? ( <Image src={fillHeartIcon} alt="하트아이콘" width={20} height={20} /> ) : ( <Image src={heartIcon} alt="하트아이콘" width={20} height={20} /> )} <h5 className="text-[12px]">{favoriteCount}</h5> </button> </div> </div> ); }

  • react
  • next.js
  • react-query
  • next-auth
  • msw
댓글 1 좋아요 0 조회수 227

다중회귀

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

안녕하세요 😊 3유형을 잡고자 놀이터 문제 다 풀이하고 추가적으로 문제집 풀이 시작했는데 다중 선형 회귀랑 다중 회귀 모형이 다른 거 일까요?? 문제집에 있는 거 풀이하다가 답이 달라서 한번 강사 님께서 올려주신 문제로 문제집에 있는 풀이 방법이랑 강사 님께서 해주신 풀이 방법으로 각각 해보니 서로 다른 답이 나오네요.. sm.OLS랑 formula.api.ols 차이를 알고 싶습니다! #데이터 import pandas as pd df = pd.DataFrame({ '매출액': [300, 320, 250, 360, 315, 328, 310, 335, 326, 280, 290, 300, 315, 328, 310, 335, 300, 400, 500, 600], '광고비': [70, 75, 30, 80, 72, 77, 70, 82, 70, 80, 68, 90, 72, 77, 70, 82, 40, 20, 75, 80], '플랫폼': [15, 16, 14, 20, 19, 17, 16, 19, 15, 20, 14, 5, 16, 17, 16, 14, 30, 40, 10, 50], '투자':[100, 0, 200, 0, 10, 0, 5, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }) df.head(3) # 풀이 1 from statsmodels.formula.api import ols model1 = ols('매출액 ~ 광고비 + 플랫폼', data=df).fit() print(model1.summary()) #풀이2(문제집) import statsmodels.api as sm X=df[['광고비','플랫폼']] y=df[['매출액']] model2 = sm.OLS(y,X).fit() print(model2.summary())

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
수지 댓글 1 좋아요 1 조회수 265

카이제곱통계량 독립성 검정, 적합성 검정 문의입니다.

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

카이제곱통계량 독립성 검정 시, crosstab을 이용해 표를 만들어 chi2_contingency 이용해 값을 구하고 적합성 검정 시, 리스트를 만들어 관찰값, 예측값을 chisquare을 이용해 값을 구한다 이렇게 이해하면 될가요?

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
석구 댓글 2 좋아요 0 조회수 371

인기 태그

인프런 TOP Writers

주간 인기글