๐Ÿ“’ Today I Learn/๐Ÿ Python

240430 Today I LearnPandas '.loc[]' ๋ฐ์ดํ„ฐํ”„๋ ˆ์ž„์—์„œ ํ–‰ ์กฐํšŒํ•˜๊ธฐ๐Ÿ’ก dataframe.loc[ ํ–‰ ์ธ๋ฑ์‹ฑ ๊ฐ’, ์—ด ์ธ๋ฑ์‹ฑ ๊ฐ’]๋ผ๋ฒจ๋กœ ์ธ๋ฑ์‹ฑ, ๋๋ฒˆํ˜ธ ํฌํ•จ์Šฌ๋ผ์ด์‹ฑ ๊ฐœ๋… ์ ์šฉ ๊ฐ€๋Šฅโ–ถ๏ธŽ ํ™œ์šฉ ์˜ˆ์‹œ ) ๊ฐ€์žฅ ๋งŽ์€ ๊ฐ€์กฑ์„ ๊ฐ€์ง„ ์Šน๊ฐ ์ฐพ๊ธฐfamily = df['SibSp']+df['Parch']name = ''for i, k in enumerate(family): if k == max(family): print(df.loc[i]['Name']) ## Sage, Master. Thomas Henry## Sage, Miss. Constance Gladys## Sage, Mr. Frederick## Sage, Mr. George John Jr## Sage, Mi..
240426 Today I Learn์ „์—ญ๋ณ€์ˆ˜ vs. ์ง€์—ญ๋ณ€์ˆ˜์ „์—ญ๋ณ€์ˆ˜ : ํ”„๋กœ๊ทธ๋žจ ์ „์ฒด์—์„œ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•œ ๋ณ€์ˆ˜์ง€์—ญ๋ณ€์ˆ˜ : ํ•จ์ˆ˜ ๋‚ด์—์„œ๋งŒ ์‚ฌ์šฉ๋˜๋Š” ๋ณ€์ˆ˜→ ์ง€์—ญ๋ณ€์ˆ˜๋ฅผ ์ „์—ญ๋ณ€์ˆ˜๋กœ ๋ฐ”๊พธ๊ณ  ์‹ถ์„ ๋•Œ์—๋Š” ๋ณ€์ˆ˜ ์•ž์— `glob`๋ฅผ ๋ถ™์ด๋ฉด ๋œ๋‹ค.def modify_global(): global global_var global_var = 30 print("ํ•จ์ˆ˜ ๋‚ด์—์„œ ์ˆ˜์ •๋œ ์ „์—ญ๋ณ€์ˆ˜:", global_var) ๊ฐ€๋ณ€์ธ์ˆ˜args : ํ•จ์ˆ˜ ํ˜ธ์ถœ์‹œ ์ž„์˜์˜ ๊ฐœ์ˆ˜์˜ ์œ„์น˜์ธ์ˆ˜๋ฅผ ์ „๋‹ฌ- sum_values(1,2,3,4,5,6,7)๋„ ๋“ค์–ด๊ฐˆ ์ˆ˜ ์žˆ์Œ (๋ณ€์ˆ˜์˜ ๊ฐœ์ˆ˜๊ฐ€ ๋‹ฌ๋ผ๋„ ๋จ)def sum_values(*args): total = 0 for num in args: total += num ret..
ny:D
'๐Ÿ“’ Today I Learn/๐Ÿ Python' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (8 Page)