728x90

๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ 128

[Python] set ์ž๋ฃŒํ˜• ์ด์šฉํ•ด ๋ฆฌ์ŠคํŠธ ์ค‘๋ณต ์ œ๊ฑฐ + ๋ฆฌ์ŠคํŠธ ์ฐจ์ง‘ํ•ฉ

๋‘ ๋ฆฌ์ŠคํŠธ๊ฐ€ ์žˆ์„ ๋•Œ ์„œ๋กœ ์ค‘๋ณต๋˜๋Š” ๊ฐ’์„ ์ œ์™ธํ•œ ๊ฐ’๋“ค์„ ๋ณด๊ณ  ์‹ถ๋‹ค๋ฉด set ์ž๋ฃŒํ˜•์„ ์ด์šฉ a = [1, 2, 3, 4] b = [2, 3, 5, 6, 7] 2, 3์ด ๊ฒน์น˜๋Š” ์›์†Œ [x for x in a if x not in set(b)]โ€‹ ์ˆœ์„œ๋ฅผ ๋ณด์กดํ•ด ์ฐจ์ง‘ํ•ฉ ์ถœ๋ ฅ set(a) - set(b) ์ˆœ์„œ ๋ณด์กด x ์ฐจ์ง‘ํ•ฉ ์ถœ๋ ฅ ๋ฆฌ์ŠคํŠธ ์ฐจ์ง‘ํ•ฉ a = ['abc', 'abcd', 'abcde'] b = ['bc', 'abc', 'abcd'] print([x for x in a if x not in b])

๋งˆํฌ๋‹ค์šด ํŒŒ์ผ(.md) pdf ๋กœ ์ €์žฅํ•ด์ฃผ๋Š” ์‚ฌ์ดํŠธ

www.markdowntopdf.com/ Convert your markdown files to PDF with our online converter for free! Select and upload your file containing markdown markup and we'll convert it to a PDF for you in an instant. www.markdowntopdf.com md2pdf.netlify.app/ ++++++++++++++++ ๋งˆํฌ๋‹ค์šด ์˜จ๋ผ์ธ ์—๋””ํ„ฐ, ์‹คํ–‰ ๊ฒฐ๊ณผ ๋ณผ ์ˆ˜ ์žˆ๋Š” url stackedit.io/ StackEdit – In-browser Markdown editor Stay connected StackEdit can sync your files with Goo..

Note 2021.03.21

[DB] ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์‹œ์Šคํ…œ

3์žฅ. ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์‹œ์Šคํ…œ DB, DBMS, DB ์‹œ์Šคํ…œ์˜ ์ฐจ์ด ์ดํ•ด DB ์‹œ์Šคํ…œ์˜ ๊ตฌ์„ฑ ์š”์†Œ DB์˜ 3๋‹จ๊ณ„ ๊ตฌ์กฐ์—์„œ ๋ฐ์ดํ„ฐ ๋…๋ฆฝ์„ฑ์˜ ๊ฐœ๋…์„ ์‹คํ˜„ํ•˜๋Š” ๋ฐฉ๋ฒ• ์ดํ•ด DB ์‚ฌ์šฉ์ž๋ณ„ ํŠน์ง• DBMS์˜ ๊ตฌ์„ฑ 1. ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์‹œ์Šคํ…œ์˜ ์ •์˜ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์‹œ์Šคํ…œ(DBS, DataBase System) ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๊ณ , ์ด๋ฅผ ๊ด€๋ฆฌํ•ด ์กฐ์ง์— ํ•„์š”ํ•œ ์ •๋ณด๋ฅผ ์ƒ์„ฑํ•ด์ฃผ๋Š” ์‹œ์Šคํ…œ (๋‹ค์–‘ํ•œ ๋ชฉ์ ์˜ ์ •๋ณด ์‹œ์Šคํ…œ ๊ตฌ์ถ•์— ํ•„์š”ํ•œ ์ค‘์š”ํ•œ ํ•ต์‹ฌ ์š”์†Œ, ์ „์ฒด์ ์ธ ์‹œ์Šคํ…œ ์˜๋ฏธ) 2. ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ๊ตฌ์กฐ ์Šคํ‚ค๋งˆ์™€ ์ธ์Šคํ„ด์Šค ์Šคํ‚ค๋งˆ(schema): ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์ €์žฅ๋˜๋Š” ๋ฐ์ดํ„ฐ ๊ตฌ์กฐ์™€ ์ œ์•ฝ ์กฐ๊ฑด ์ •์˜ํ•œ ๊ฒƒ ์ธ์Šคํ„ด์Šค(instance): ์Šคํ‚ค๋งˆ์— ๋”ฐ๋ผ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์‹ค์ œ๋กœ ์ €์žฅ๋œ ๊ฐ’ 3๋‹จ๊ณ„ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๊ตฌ์กฐ ์‚ฌ์šฉ์ž์˜ ๊ด€์ ์— ๋”ฐ๋ผ ๋ฐ์ดํ„ฐ..

[Java] JDK, JRE, ์ž๋ฐ” ๋ฐฐํฌํŒ ์ข…๋ฅ˜, ์ดํด๋ฆฝ์Šค

JDK(Java Development Kit) ๊ฐœ๋ฐœ์ž์šฉ ์ž๋ฐ” ์ž๋ฐ” ์‘์šฉ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ, ๊ฐœ๋ฐœ์— ํ•„์š”ํ•œ ๋„๊ตฌ ํฌํ•จ JDK ๊น”๋ฉด ์ž๋™์œผ๋กœ JRE(Java Runtime Environment, ์ž๋ฐ” ์‹คํ–‰ ํ™˜๊ฒฝ) ์ƒ์„ฑ ์ž๋ฐ” ๋ฐฐํฌํŒ ์ข…๋ฅ˜ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์— ๋”ฐ๋ผ ๋‹ค์–‘ํ•œ ๋ฐฐํฌํŒ ์ œ๊ณต Java SE ์ž๋ฐ” ํ‘œ์ค€ ๋ฐฐํฌํŒ ๋ฐ์Šคํฌํƒ‘๊ณผ ์„œ๋ฒ„ ์‘์šฉ ๊ฐœ๋ฐœ ํ”Œ๋žซํผ Java ME ์ž๋ฐ” ๋งˆ์ดํฌ๋กœ ๋ฐฐํฌํŒ ์ž„๋ฒ ๋””๋“œ, ๊ฐ€์ „ ์ œํ’ˆ ์œ„ํ•œ API ์ •์˜ Java EE ์ž๋ฐ” ๊ธฐ์—…์šฉ ๋ฐฐํฌํŒ Java ๋ชจ๋“ˆ ํ”„๋กœ๊ทธ๋ž˜๋ฐ Java 9๋ถ€ํ„ฐ ๋ชจ๋“ˆ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์‹œ์ž‘ ๋ชจ๋“ˆ ๋ฐฉ์‹ ์•„๋‹Œ ๊ธฐ์กด ๋ฐฉ์‹์œผ๋กœ ์ž๋ฐ” ํ”„๋กœ๊ทธ๋ž˜๋ฐ ํ•ด๋„ ๋ฌด๊ด€ ์ž๋ฐ” API JDK์— ํฌํ•จ๋œ ํด๋ž˜์Šค ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ (๋‚ด๊ฐ€ ๋งŒ๋“ค์ง€ ์•Š์€ ํ”„๋กœ๊ทธ๋žจ) ๊ฐœ๋ฐœ์ž๋Š” API๋ฅผ ์ด์šฉํ•ด ์‰ฝ๊ณ  ๋น ๋ฅด๊ฒŒ ์ž๋ฐ” ํ”„๋กœ๊ทธ๋žจ ๊ฐœ๋ฐœ ์ž๋ฐ” ํŒจํ‚ค์ง€(pack..

[Java] ์ž๋ฐ” ์‹œ์ž‘

๊ฐ์ฒด์ง€ํ–ฅํ”„๋กœ๊ทธ๋ž˜๋ฐ ์™„์ „ ๊ธฐ์ดˆ ์ปดํ“จํ„ฐ์™€ ์†Œํ”„ํŠธ์›จ์–ด ํ”„๋กœ๊ทธ๋ž˜๋ฐ: ํ”„๋กœ๊ทธ๋ž˜๋จธ๊ฐ€ ๋งŒ๋Šฅ ๊ธฐ๊ณ„์ธ ์ปดํ“จํ„ฐ๋ฅผ ์ด์šฉํ•ด ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ๊ฐœ๋ฐœํ•˜๋Š” ๊ฒƒ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด ์ปดํ“จํ„ฐ๊ฐ€ ์‹คํ–‰ํ•  ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜๊ธฐ ์œ„ํ•œ ์–ธ์–ด(์ปดํ“จํ„ฐ ์–ธ์–ด, ๊ธฐ๊ณ„์–ด) ๊ธฐ๊ณ„์–ด 0, 1์˜ ์ด์ง„์ˆ˜๋กœ ๊ตฌ์„ฑ๋œ ์–ธ์–ด ์ปดํ“จํ„ฐ์˜ CPU๋Š” ๊ธฐ๊ณ„์–ด๋งŒ ์ดํ•ด, ์ฒ˜๋ฆฌ๊ฐ€๋Šฅ ์–ด์…ˆ๋ธ”๋ฆฌ์–ด ๊ธฐ๊ณ„์–ด ๋ช…๋ น์„ ADD, SUB, MOVE๋“ฑ๊ณผ ๊ฐ™์€ ํ‘œํ˜„ํ•˜๊ธฐ ์‰ฌ์šด ์ƒ์ง•์ ์ธ ๋‹จ์–ด์ธ ๋‹ˆ๋ชจ๋‹‰ ๊ธฐํ˜ธ(mnemonic symbol)๋กœ ์ผ๋Œ€์ผ ๋Œ€์‘์‹œํ‚จ ์–ธ์–ด (๊ธฐ๊ณ„์–ด BASE, ์ž์ฃผ ์“ฐ๋Š” ๊ธฐํ˜ธ๋“ค ์ด์šฉํ•ด์„œ ๋Œ€์‘, ์ž์ฃผ ์“ธ ์ˆ˜ ์žˆ๋„๋ก ์ƒ์ง•ํ•ด์ฃผ๋Š” ์–ธ์–ด) ๊ณ ๊ธ‰์–ธ์–ด ์‚ฌ๋žŒ์ด ์ดํ•ดํ•˜๊ธฐ ์‰ฝ๊ณ , ๋ณต์žกํ•œ ์ž‘์—…, ์ž๋ฃŒ๊ตฌ์กฐ, ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ํ‘œํ˜„ํ•˜๊ธฐ ์œ„ํ•ด ๊ณ ์•ˆ๋œ ์–ธ์–ด ์ ˆ์ฐจ ์ง€ํ–ฅ ์–ธ์–ด์™€ ๊ฐ์ฒด ์ง€ํ–ฅ ์–ธ์–ด๋กœ ๋‚˜๋ˆŒ ์ˆ˜ ์žˆ์Œ ๊ณ ๊ธ‰ ์–ธ์–ด(High-qu..

[Python] ํŒ๋‹ค์Šค ๋ฐ์ดํ„ฐํ”„๋ ˆ์ž„(Pandas DataFrame) sys:1: DtypeWarning: Columns have mixed types.Specify dtype option on import or set low_memory=False. ๋ฌด์‹œํ•˜๊ธฐ

column์— NaN๊ฐ’์ด๋‚˜ ์—ฌ๋Ÿฌ type์˜ ๋ฐ์ดํ„ฐ๊ฐ€ ์„ž์—ฌ ์žˆ์œผ๋ฉด ์ด์™€ ๊ฐ™์€ ๊ฒฝ๊ณ ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค. ์ด ๋•Œ ๊ฒฝ๊ณ  ๋ฉ”์‹œ์ง€๊ฐ€ ์•Œ๋ ค์ฃผ๋Š” ๋Œ€๋กœ dtype option์œผ๋กœ ํƒ€์ž…์„ ๋ช…์‹œํ•ด์ฃผ๊ฑฐ๋‚˜ low_memory = False๋กœ ์ง€์ •ํ•ด ์ฃผ๋ฉด ๊ฒฝ๊ณ  ๋ฉ”์‹œ์ง€๊ฐ€ ์ถœ๋ ฅ๋˜์ง€ ์•Š๋Š”๋‹ค. pd.read_csv('[ํŒŒ์ผ๋ช…].txt', delimiter = '\t', low_memory=False)

[Python] ํŒ๋‹ค์Šค ๋ฐ์ดํ„ฐํ”„๋ ˆ์ž„(pandas dataframe) SettingWithCopyWarning ํ•ด๊ฒฐ

๊ธฐ์กด ๋ฐ์ดํ„ฐํ”„๋ ˆ์ž„ ์ผ๋ถ€๋ฅผ ๋ณต์‚ฌํ•˜๊ฑฐ๋‚˜ ์ธ๋ฑ์‹ฑ ํ›„ ๊ฐ’์„ ์ˆ˜์ •ํ•  ๋•Œ ์ข…์ข… ๋ฐœ์ƒํ•œ๋‹ค. ๊ธฐ์กด ๋ฐ์ดํ„ฐํ”„๋ ˆ์ž„์„ ๊ฐ€์ ธ์™€(๋ณต์‚ฌ) ๋‹ค๋ฅธ ๋ฐ์ดํ„ฐํ”„๋ ˆ์ž„์„ ๋งŒ๋“ค ๋•Œ ์›๋ณธ์„ ์ˆ˜์ •ํ•  ์ง€ ๋ณต์‚ฌ๋ณธ์„ ์ˆ˜์ •ํ•  ์ง€ ๋ชฐ๋ผ์„œ ๋ฐœ์ƒํ•˜๋Š” ์˜ค๋ฅ˜๋ผ๊ณ  ํ•œ๋‹ค. ๋‘ ๊ฐ€์ง€ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์ด ์žˆ๋Š”๋ฐ, ํ•˜๋‚˜๋Š” ๊ฒฝ๊ณ ๋ฅผ ๋ฌด์‹œํ•˜๋Š” ๊ฒƒ์ด๊ณ  ํ•˜๋‚˜๋Š” copy๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ! 1. ๊ฒฝ๊ณ  ๋ฌด์‹œ pd.set_option์„ ์‚ฌ์šฉํ•œ ๊ฒฝ๊ณ ๋ฌธ ์ œ๊ฑฐ # SettingWithCopyError --> ์˜ค๋ฅ˜ raise ๋กœ ์ฝ”๋“œ ์‹คํ–‰ X pd.set_option('mode.chained_assignment', 'raise') # SettingWithCopyWarning --> ์‹คํ–‰์€ ๋˜์ง€๋งŒ ๊ฒฝ๊ณ ๋ฌธ ๋œธ pd.set_option('mode.chained_assignment', 'warn') # err..

[Python] ํŒ๋‹ค์Šค concat, append, join, merge ์ฐจ์ด

Pandas concat vs append vs join vs merge Concat gives the flexibility to join based on the axis( all rows or all columns) Append is the specific case(axis=0, join='outer') of concat Join is based on the indexes (set by set_index) on how variable =['left','right','inner','couter'] Merge is based on any particular column each of the two dataframes, this columns are variables on like 'left_on', 'ri..

728x90