inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

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

query 메서드와의 비교

해결됨

[개념반] 배워서 바로 쓰는 Pandas

조건을 주고 그에 맞는 데이터를 필터링하여 보여준다는 점에서 .loc[] 메서드와 .query() 메서드의 기능이 동일한 건가요? 다른 점이 있다면 어떤 부분에서 다른가요?

  • python
  • pandas
까망 댓글 1 좋아요 0 조회수 389

socket.io 실행

미해결

안녕하세요 채팅을 구현하기위해 socket.io를 썼는데 통신이 안되는 것같습니다 io에 주소를 제대로 넣었고 서버 on 마다 클라이언트에서 emit으로 작성했는데 작동하지 않습니다 이유가 무엇일까요? // server 파일의 코드입니다 require('dotenv').config(); const { createApp } = require('./app'); const { appDataSource } = require('./models/index'); const startServer = async () => { const app = createApp(); const PORT = process.env.PORT; await appDataSource .initialize() .then(() => { const server = app.listen(PORT, () => { console.log(`🟢server is listening on ${PORT}🟢`); }); const io = require('socket.io')(server, { cors: { origin: true, credentials: true, }, }); const { socketMessage } = require('./middlewares/socket.io'); socketMessage(io); }) .catch((err) => { console.log(`❌Failed server connect❌`); appDataSource.destroy(); }); }; startServer(); // server의 socket 파일의 코드입니다 const jwt = require('jsonwebtoken'); const chatDao = require('../models/chatDao'); const { catchAsync } = require('../utils/error'); const socketMessage = (io) => { io.use((socket, next) => { const token = socket.handshake.headers.authorization; if (!token) { return next(new Error('Authentication error')); } jwt.verify(token, process.env.SECRET_KEY, async (err, decoded) => { if (err) { return next(new Error('Authentication error')); } userId = decoded.userId; next(); }); }); io.on('connection', (socket) => { console.log('A User Connected.'); socket.on( 'create_room', catchAsync(async (postId, callback) => { const room = await chatDao.createRoom(userId, postId); socket.join(room.raw.insertId); callback(room.raw.insertId); }) ); socket.on( 'enter_room', catchAsync(async (roomId, callback) => { socket.join(roomId); callback(roomId); }) ); socket.on('new_text', async (content, roomId, callback) => { await chatDao.createChat(userId, content, roomId); socket.to(roomId).emit('new_text', content); callback(content); }); socket.on('disconnect', () => { console.log('접속이 해제되었습니다', socket.id); clearInterval(socket.interval); }); socket.on('error', (error) => { console.error(error); }); ​ socket.on('send', (data) => { console.log(data); socket.emit('reply', { data, }); }); socket.interval = setInterval(() => { socket.emit('news', 'Hello Socket.IO'); }, process.env.SOCKET_INTERVAL || 1000); }); }; module.exports = { socketMessage }; ​ // client 코드입니다 import React, { useState, useContext } from 'react'; import io from 'socket.io-client'; import './chat.css'; import { MenuContext } from '../../components/Nav/MenuProvider'; const Token = localStorage.getItem('accessToken'); const socket = io.connect('http://192.168.0.194:4000', { withCredentials: true, extraHeaders: {Authorization: `Bearer ${Token}` } appDataSource.destroy(); }), }); socket.on('connection', () => { console.log('Connected to server'); }); const Chat = () => { const [roomId, setRoomId] = useState([]); const [searchData, setSearchData] = useContext(MenuContext); const handleCreateRoom = event => { event.preventDefault(); socket.emit('create_room', searchData, ({ searchData, roomId }) => { console.log(`Joined room ${roomId}`); setRoomId(roomId); }); }; const handleJoinRoom = roomId => { socket.emit('enter_room', roomId, roomId => { console.log(`Joined room ${roomId}`); setRoomId(roomId); }); }; const handleNewText = content => { socket.emit('new_text', content, roomId, content => { console.log(`Sent message: ${content}`); }); }; const handleNewText = content => { socket.emit('new_text', content, roomId, content => { console.log(`Sent message: ${content}`); }); }; const onCheckEnter = e => {if (e.key === 'Enter') { handleNewText(); } }; return ( <div className="h-screen pt-36"> <button onClick={handleCreateRoom}>테스트</button> <button onClick={() => handleJoinRoom(roomId)}>테스트2</button> <input id="input-text" type="text" onKeyDown={onCheckEnter} /> <button onClick={handleCreateRoom}>제출</button> </div> ); }; export default Chat;

  • react
  • javascript
  • socket
  • socket.io
  • node.js
bin 댓글 1 좋아요 0 조회수 744

mysql_secure_installation password 질문이요

미해결

[리뉴얼] React로 NodeBird SNS 만들기

... Failed! Error: SET PASSWORD has no significance for user 'root'@' localhost ' as the authentication method used doesn't store authentication data in the MySQL server. Please consider using ALTER USER instead if you want to change authentication parameters. 구글링도하고 mysql다시깔아서 local password도 다시 설정했는데 자꾸 이 오류가 나오네요.. 혹시 해결 방법이 있을까요?

  • react
  • redux
  • node.js
  • express
  • next.js
dsfsdf 댓글 2 좋아요 0 조회수 661

if __name__=="__main__" 사용 기준

미해결

파이썬 알고리즘 문제풀이 입문(코딩테스트 대비)

강사님 안녕하세요 :) 유익한 강의 잘 듣고 있습니다! 학습 중 궁금한 점이 있어서 질문드립니다. 강사님께서 DFS문제 외에도 코드 시작 부분에 이 코드를 작성하실 때가 종종 있는데 혹시 강사님의 사용 기준이 있는지 궁금합니다. ex) [섹션 8] 회장뽑기(플로이드-와샬) 사용 O vs 위상정렬(그래프 정렬) 사용 X

  • python
  • 코딩-테스트
댓글 1 좋아요 0 조회수 386

GetText()사용법

해결됨

직장인에게 꼭 필요한 파이썬-아래아한글 자동화 레시피

GetText 사용법이 감이 잘 안오네요 while과 state없이 GetText()를 실행하면 텍스트 출력이 안되네요.. 파이썬에서 정확한 문법 정의가 어떻게 되는지요?

  • python
  • 한컴오피스
schnabel 댓글 2 좋아요 1 조회수 2027

수업 자료에 오류가 있는것 같습니다 ㅠ

해결됨

한국인이 좋아하는 속도로 때려넣는 파이썬

문서 정리 자동화 소프트웨어 만들기 압축 파일에 직원 정보라는 파일이 들어있지 않네요 ㅠ

  • python
eric040928 댓글 2 좋아요 0 조회수 612

precision_recall_curve() 관련 질문드립니다.

미해결

[개정판] 파이썬 머신러닝 완벽 가이드

안녕하세요, 좋은강의 감사합니다. precision_recall_curve() 함수를 이용해서, y값과, 예측 값을 넣어주었을때 리턴되는값이 정밀도, 재현율, thresholds 값이 반환이 되는것으로 확인했습니다. 여기서 궁금한 부분이 thresholds값의 변화는 함수에서 임의로 진행 되는것 일까요?

  • python
  • 머신러닝
  • 통계
댓글 1 좋아요 0 조회수 324

행맨 만들기에서..

미해결

실리콘밸리 엔지니어가 가르치는 파이썬 기초부터 고급까지

행맨 만들기 프로젝트 일부 코드에서 이해가 안되는 부분이 있어 질문드립니다! while 문에서 i = 0 을 설정한 뒤에 elem 값이 char 의 input 값과 같으면 그 값이 lst에서 치환되는 것이라고 설명해주셨는데 lst[i] 는 lst 내에서 i+1 번째 값을 의미하는 것이 아닌가요?? 아니면 i 는 그냥 미지수의 의미로 설정한 변수로 생각하면 되나요? 비슷한 질문으로 i += 1 이라는 코드를 추가한 이유가 무엇인가요? 저 코드를 빼고 작동시켜보니 이전에 맞췄던 철자가 저장되지 않고 첫 단어에만 값이 입력되는 걸 보니 이전 값들을 차곡차곡 쌓는 느낌인가요..? 너무 초보적인 질문이라 죄송합니다.. 아무리 고민하고 찾아봐도 쉽게 답이 나오지 않아 질문드립니다..

  • python
  • 알고리즘
logic 댓글 1 좋아요 1 조회수 670

'is' 와 '==' 언제 사용하나요?

미해결

프로그래밍 시작하기 : 도전! 45가지 파이썬 기초 문법 실습 (Inflearn Original)

'is'와 '==' 차이점은 어느 정도 이해되는데, 각각을 언제 사용해야 하는지는 잘 모르겠습니다. 검색을 해보면 주로 '==' 사용하고 None 과 비교할 때 'is'를 사용한다고 하는데 실제로 이렇게 사용하나요? z = 'None' a = None print(f'z is None : {z is None}') print(f'z == None : {z == "None"}') print(f'a is None : {a is None}') print(f'a == None : {a == "None"}') z is None : False z == None : True a is None : True a == None : False

  • python
Jerry 댓글 1 좋아요 0 조회수 472

강의에 나오는 문법이 적용되지 않습니다

미해결

따라하며 배우는 노드, 리액트 시리즈 - 기본 강의

MongooseError: Model.prototype.save() no longer accepts a callback 이 오류가 떠서 확인해보니 Mongoose6부터 callback 문법이 사용되지 않는다고 합니다 버전을 바꾸는 것은 시도 하지 않았고 .then .catch or async await 로 바꾸고 싶은데 수 시간 시도해보다가 안되서 글 남깁니다. callback 구문을 보고 .then .catch or async await 이 방식으로 바꾸는 법을 알고 싶습니다. 이 부분에서만 에러가 발생하는지는 모르겠으나 stack Overflow에 적어봤는데 역시 답을 얻을 수 없더라구요 app.post("/login", (req, res) => { User.findOne({ email: req.body.email }, (err, user) => { if (!user) { return res.json({ loginSuccess: false, message: "제공된 이메일에 해당하는 유저가 없습니다.", }); } user.comparePassword(req.body.password, (err, isMatch) => { if (!isMatch) return res.json({ loginSuccess: false, message: "비밀번호가 틀렸습니다." }); user.generateToken((err, user) => { if (err) return res.status(400).send(err); res.cookie("x-auth", user.token).status(200).json({ loginSuccess: true, userId: user._id }); }); }); }); });

  • react
  • node.js
exwhite 댓글 2 좋아요 0 조회수 4275

챗지피티 때문에 결제했는데...

해결됨

ChatGPT 100% 활용하여 배우는 파이썬 기초 A to Z

ChatGPT와 함께 파이썬 시작하기 (변수, 정수) 편 아직 안올라 온건가요?

  • python
  • 알고리즘
sonyyjj 댓글 2 좋아요 0 조회수 1543

[파이썬 Print 사용법(1-4) - New 2023] NameError

미해결

프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)

파이썬 Print 사용법(1-4) - New 2023 강의에서 print로 출력하려고 하는데 자꾸 아래와 같은 오류가 떠요... 입력 값: 출력값: >>> print(f'm : {m:,}') Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'm' is not defined Python Version : 3.11.2 64-bit

  • python
Ilyeop Kang 댓글 1 좋아요 0 조회수 361

numpy의 shape

해결됨

파이썬을 활용한 머신러닝 딥러닝 입문

안녕하세요 인프런에서 강사님의 강의(파이썬을 활용한 머신러닝 딥러닝 입문)를 수강 중인 손승운입니다. 질문 '파이썬을 활용한 머신러닝 딥러닝 입문' 강의 12강 내용 7분 18초를 보면 주피터 노트에서는 z.shape의 값이 (axis2, axis0, axis1) 순서로 나오고 제가 직접 주피터노트에 실습한 결과도 동일했습니다. 하지만 7분 33초 중앙을 보면 shape를 (axis0, axis1, axis2)로 표현하셨는데, 이는 구글링을 통해 다른 사람들이 표현한 것과 같습니다. 그럼 (axis2, axis0, axis1)와 (axis0, axis1, axis2) 둘 중 어느 것이 맞는 표현인가요? 혹시 원래는 (axis0, axis1, axis2)로 표현해야 하지만 numpy를 활용해 shape를 볼 때만 (axis2, axis0, axis1)로 표현되는 건가요? 강사님의 강의 덕에 머신러닝 개발자가 되는데 한걸음 내딛을 수 있었습니다. 감사합니다. 편하신 시간에 답변주시면 감사하겠습니다.

  • 머신러닝
  • numpy
  • 딥러닝
  • tensorflow
  • 딥러닝
  • keras
  • anaconda
  • pandas
  • python
  • 머신러닝 배워볼래요?
  • matplotlib
  • cnn
thstmddns 댓글 1 좋아요 0 조회수 628

새일기를 쓰면 한개가 아닌 두개가 등록이 됩니다ㅠ

해결됨

한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지

윈터로드님 알려주신 덕분에 완강할수잇었습니다ㅠㅠ 인프런 강의 첫 수강완료증을 받앗네요 제 프로젝트에 큰오류를 발견했습니다,,,, 새일기쓰면 똑같은게 2개가 만들어지는데 이거 어디서 오류를 수정해야 하는지알수잇을까요?

  • react
  • node.js
  • javascript
  • nodejs
대조동이강인 댓글 1 좋아요 0 조회수 674

셀레늄 실습중 문의

해결됨

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

수업을 듣고 다른 사이트로 실습을 해보려고 하는데, jsp로 만들어진 공공기관 사이트는 뭔가 잘 안먹히는 모습니다. 아래 사이트의 테이블 정보를 가져오고 싶은데, 얘네들은 클릭해도 주소가 변경되는것도 없고 아래와 같이 table이 들어있는 상위 class 태그를 찾아서 정의하고, 거기에서 table의 class명을 넣고 tbody, tr까지 찾아들어가도록 코딩을 했는데 table의 class명이 없다고 에러가 뜹니다. 이런 사이트의 table내 정보는 어떻게 가져올 수 있고, 테이블에 있는 원자재를 클릭해서 넘어가는 페이지는 어떻게 찾아갈 수 있나요?(XPATH, LINK_TEXT해도 먹히지 않아요..) https://www.motie.go.kr/motie/py/sa/todayeconomyindexprice/todayEconomyIndexPri.jsp url = "http://www.motie.go.kr/motie/py/sa/todayeconomyindexprice/todayEconomyIndexPri.jsp" driver.get(url) time.sleep(2) # driver.find_element(By.LINK_TEXT,"통계정보").click() # time.sleep(2) # driver.find_element(By.LINK_TEXT,"원자재가격정보") # time.sleep(2) class1 = driver.find_element(By.CLASS_NAME,"iframeLayout01") #테이블은 위와 같이 <table>안에 <tbody>, <tbdoy>안에 <tr>, <tr>안에 <td> 순으로 포함되어 있다. table_content = class1.find_element(By.CLASS_NAME,"data_print") tbody = table_content.find_element(By.TAG_NAME,"tbody") rows = tbody.find_elements(By.TAG_NAME,"tr") for index, value in enumerate(rows): body=value.find_elements(By.TAG_NAME,"td")[0] print(body.text)

  • python
  • 웹-크롤링
  • 웹-크롤링
  • selenium
  • beautifulsoup
쥰쓰 댓글 1 좋아요 0 조회수 831

tfjs-node 안깔려서

미해결

비전공자를 위한 진짜 입문 올인원 개발 부트캠프

tfjs-node 안깔려서 해보라고 하는거 해보다가 잘 되던 nodemon server.js 도 안되고 뭐가 잘못됐는지 모르겠습니다. 빨리 마무리하고 싶은데 답답하네요 강의 업데이트 좀 해주셨으면 좋겠는데 생각 없으신가요

  • react-native
  • 머신러닝 배워볼래요?
  • nodejs
  • tensorflow
  • HTML/CSS
  • express
  • react
  • javascript
exwhite 댓글 1 좋아요 0 조회수 1132

mongoose save() 어쩌구 에러나시는 분들

미해결

따라하며 배우는 노드, 리액트 시리즈 - 기본 강의

app.post('/register',(req,res)=>{ //회원가입할 때 필요한 정보들을 client에서 가져오면, //그 정보들을 DB에 넣어준다. const user = new User(req.body); //user모델에 정보가 저장됨 //실패 시, 실패한 정보를 보내줌 user.save().then(()=>{ res.status(200).json({ success:true }) }).catch((err)=>{ return res.json({success:false,err}) }); })

  • nodejs
  • react
김재현 댓글 5 좋아요 13 조회수 1642

{% for i in range(block_start, block_last + 1 ) %} 에서

미해결

남박사의 파이썬으로 실전 웹사이트 만들기

{% for i in range(block_start, block_last + 1 ) %} 에서 block_last + 1을 해주는 이유가 궁금합니다.

  • python
날아라숑 댓글 2 좋아요 0 조회수 422

suggestion에서 onFollowUser을 수행할때 에러 질문입니다!

해결됨

파이썬/장고 웹서비스 개발 완벽 가이드 with 리액트

import React from "react"; import { Button, Avatar } from "antd"; import "./Suggestion.scss"; //프레젠테이션 컴포넌트라 할 수 있다 export default function Suggestion({ suggestionUser, onFollowUser }) { const { username, avatar, is_follow } = suggestionUser; return ( <div className="suggestion"> <div className="avatar"> <Avatar icon={<img src={avatar} alt={`${username}'s avatar`} />} /> {/* <UserAddOutlined /> */} </div> <div className="usesrname">{username}</div> <div className="action"> {is_follow && "팔로잉 중"} {!is_follow && ( <Button size="small" onClick={() => onFollowUser(username)}> Follow </Button> )} </div> </div> ); } import React, { useEffect, useState } from "react"; import "./SuggestionList.scss"; import { Card } from "antd"; import Suggestion from "./Suggestion"; import { useAppContext } from "store"; import Axios from "axios"; import useAxios from "axios-hooks"; export default function SuggestionList({ style }) { const { store: { jwtAccessToken }, } = useAppContext(); const [userList, setUserList] = useState([]); //axios을 좀더 일반적으로 쓰기위한 훅을 이용 useAxios hook //useEffect자체가 필요없다 요청자체를 useAxios가 보내게 되니까? //useAxios는 조회를 할때는 유용한다 post을 할때는 코드가 복잡해진다? const headers = { Authorization: `Bearer ${jwtAccessToken}` }; const [{ data: origUserList, loading, error }, refetch] = useAxios({ url: "http://127.0.0.1:8000/accounts/suggestions/", headers, }); useEffect(() => { if (!origUserList) setUserList([]); else setUserList(origUserList.map((user) => ({ ...user, if_follow: false }))); }, [origUserList]); const onFollowUser = (username) => { console.log("성공"); try { Axios.post( "http://127.0.0.1:8000/accounts/follow/", { username }, { headers } ) .then((response) => { setUserList((prevUserList) => { return prevUserList.map((user) => { if (user.username === username) { return { ...user, is_follow: true }; } else return user; }); }); }) .catch((error) => { console.log(error); }); } catch (error) { console.log("여기 에러야 :", error); } }; return ( <div style={style}> {/* 정말 빠르게 지나갈 것이다 */} {loading && <div>Loading...</div>} {error && <div>로딩중에 에러가 발생했습니다.</div>} {/* <button onClick={() => refetch()}>Reload</button> */} <Card size="small" title="Suggestions for you" // extra={<a href="#">More</a>} style={{ width: 300, }} > {userList.map((suggestionUser) => ( <Suggestion key={suggestionUser.username} suggestionUser={suggestionUser} onFollowUser={onFollowUser} //속성값으로 주입함 /> ))} </Card> </div> ); } 첫번째 블럭이 Suggestion.js이고 두번째 블럭은 SuggestionList.js입니다. follow 버튼을 눌렀을때 이러한 에러가 뜨기 시작했는데 왜 그런걸까요ㅠㅠ 분명 원래는 잘 되었는데 학습진도를 더 나가다 보니 어느순간 작동하지 않던데 그 이유를 잘 모르겠습니다 서버쪽으로 요청도 가지 않는거 같은데 서버쪽의 문제일 수 있을까요??

  • docker
  • django
  • python
  • react
꺼넝 댓글 1 좋아요 0 조회수 477

self

해결됨

코딩테스트 [ ALL IN ONE ]

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 노드를 구현할때, 함수의 변수안에 self가 있는데 이게 어떤 역할을 하는지 궁금합니다.

  • python
  • algorithm
  • 코테 준비 같이 해요!
kyle3444 댓글 1 좋아요 2 조회수 653

인기 태그

인프런 TOP Writers

주간 인기글