[파워 유저를 위한 파이썬express] 15장 프로그래밍 programming 솔루션 답지
1. import pandas as pd df1 = pd.DataFrame({'item': ['ring0', 'ring0', 'ring1', 'ring1'], 'type': ['Gold', 'Silver', 'Gold', 'Bronze'], 'price': [20000, 10000, 50000, 30000]}) df2 = df1.pivot(index='item', columns='type', values='price') print(df2) 3. >>> df[ ['area', 'population'] ] area population KR 98480 48422644 US 9629091 310232863 JP 377835 127288000 CN 9596960 1330044000 RU 17100000 14070..
2023. 1. 8.
[파워 유저를 위한 파이썬express] 14장 프로그래밍 programming 솔루션 답지
1. import numpy as np a = np.arange(0,9).reshape((3, 3)) print(a) 3. import numpy as np a = np.random.random((10,10)) amin, amax = a.min(), a.max() print(amin, amax) 5. import numpy as np a = np.zeros((5, 5),dtype=int) a[1::2,::2] = 1 a[::2,1::2] = 1 print(a) 7. import numpy as np x = np.arange(10) print(x) x[(x >= 5) & (x
2023. 1. 8.