Loyha Metodologiyasi nima? Barcha javoblar to’g’ri
names=np.array(["Hasan","Ali","Shohrux","Hasan","Mirzabek"]) masiviga mos data=
Download 27.8 Kb.
|
1 2
Bog'liq1-semestr
names=np.array(["Hasan","Ali","Shohrux","Hasan","Mirzabek"]) masiviga mos data=np.random.randn(5,4) data masivi mavjud shu malumotlardan “Hasan”ga tegishli ma’lumotlarni ajratib oling.
data[names=="Hasan"] data([names=="Hasan"]) data[names="Hasan"] data(names=="Hasan") names1=np.array(["Hasan","Ali","Shohrux","Hasan","Mirzabek"]) masiviga mos data1=np.random.randn(5,4) data masivi mavjud shu malumotlardan “Ali”ga tegishli bo’lmagan ma’lumotlarni ajratib oling. data[names!="Ali"] data([names!=" Ali "]) data[names==" Ali "] data[names=="Ali"] names1=np.array(["Hasan","Ali","Shohrux","Hasan","Mirzabek"]) masiviga mos data1=np.random.randn(5,4) data masivi mavjud shu malumotlardan “Ali”ga va “Shohrux”tegishli bo’lmagan ma’lumotlarni ajratib oling. data[(names != "Ali") | (names != "Shohrux")] data[(names != " Shohrux ") & (names != " Ali ")] data[(names == "Ali") | (names == "Shohrux")] data[(names == "Ali") | (names != "Shohrux")] names2=np.array(["Hasan","Ali","Shohrux","Hasan","Mirzabek"]) masiviga mos data2=np.random.randn(5,4) data masivi mavjud shu malumotlardan “Hasan”ga va “Mirzabek”tegishli bo’lgan ma’lumotlarni ajratib oling. data[(names == " Hasan") | (names == "Mirzabek")] data[(names == " Mirzabek ") & (names == "Hasan")] data[(names != " Hasan") | (names != " Mirzabek ")] data[(names == "Hasan ") | (names != "Mirzabek ")] data=np.random.randn(4,4) ning 0 dan katta elimentlarini 1 ga almashtiruvchi kodni ko’rsating. data[data>0]=1 data[data<0]=1 data(data>0)=1 data([data>0])=1 arr=np.arange(24) shu massivni sakkizga turt massiv ko’rinishiga keltiruvchi kodni yozing. arr.reshape(8,4) arr.shape(8,4) arr.resize(8,4) arr.reshape(4,8) data1=np.arange(10) data1 massivining mos ravishda elimentlarining kvadrat ildizi va elementlarini kvadratga ko’taruvchi metodlarni toping. np. sqrt(data1) va np.square(data1) np.square(data1) va np. sqrt(data1) np.exp(data1) va np.sqrt(data1) pd.sqrt(data1) va pd.square(data1) data=np.arange(1,10) data massivining mos ravishda elimentlarining logorifimini va elementlarini exponintini hisoblovchi metodlarni toping. np.log(data) va np.exp(data) np.exp(data) va np.log(data) np.modf(data) va np.exp(data) np.sqrt(data) va np.log(data) massiv1=np.arange(0.1,0.8,0.1), massiv2=np.arange(1.1,1.8,0.1)) ikkala massivni mos elementlarini ko’paytirish metodilarini ko’rsating. np.multiply(massiv1,massiv2) va massiv1*massiv2 np.add(massiv1,massiv2) va massiv1*massiv2 np.maximum(massiv1,massiv2) va np.add(massiv1,massiv2) np.power(massiv1,massiv2) va massiv1*massiv2 arr massivining elementlari agar 0 dan katta bo’lsa 1 ga aks holda -1 ga almashtiruvchi kodni toping. np.where(arr>0,1,-1) arr.where(arr>0,1,-1) np.where(arr<0,1,-1) np.where(arr>0,-1,1) arr=np.arange(1,21).reshape(5,4) massivning elimentlarini vertikal yunalishda yug’indisini topuvchi kodni ko’rsating. np.sum(arr,axis=0) pd.sum(arr,axis=0) np.sum(arr,axis=1) pd.sum(arr,axis=1) arr=np.arange(1,21).reshape(5,4) massivning elimentlarini garizantal yunalishda yug’indisini topuvchi kodni ko’rsating. np.sum(arr,axis=1) pd.sum(arr,axis=1) np.mean(arr,axis=0) pd.sum(arr,axis=0) arr=np.arange(1,21).reshape(5,4) massivning elimentlarini vertikal yunalishda o’rtacha qiymatini topuvchi kodni ko’rsating. np.mean(arr,axis=0) pd.mean(arr,axis=0) np.sum(arr,axis=1) pd.mean(arr,axis=1) arr=np.arange(1,21).reshape(5,4) massivning elimentlarini garizantal yunalishda o’rtacha qiymatini topuvchi kodni ko’rsating. np.mean(arr,axis=1) pd.mean(arr,axis=1) np.sum(arr,axis=0) np.mean(arr,axis=0) Yig'indilab boradigan yig'indi metodini ko’rsating cumsum() cumprod() mean() sum() Yig'ilib boriladigan ko'paytma metodini ko’rsating. cumprod() cumsum() sum() mean() arr=np.random.randn(10) massivni teskari tartiblang. -np.sort(-arr) np.sort(-arr) -np.sort(arr) np.sort(arr) ikki ulchamli (3x4) arr massivini elimentlarini vertikal yunalishda elimentlarini tartiblang. np.sort(arr,axis=0) np.sorted(arr,axis=0) pd.sort(arr,axis=1) np.sort(arr,axis=1) ikki ulchamli (3x4) arr massivini elimentlarini garizantal yunalishda elimentlarini tartiblang. np.sort(arr,axis=1) np.sorted(arr,axis=1) pd.sort(arr,axis=0) np.sort(arr,axis=0) massivdagi takrorlanmas elementlarni qaytaruvchi (takrorlansa ham faqat bittasini qabul qiluvchi) funksiyani ko’rsating. np.unique() np.in1d() np.setdiff1d() pd.setdiff1d() arr1 va arr2 massivlari mavjud. arr2 dagi elementlarni arr1 da mavjudligini tekshirish kodini tug’ri ko’rsating. np.in1d(arr1,arr2) np.setdiff1d(arr1,arr2) np.in1d(arr2,arr1) np.setdiff1d(arr2,arr1) arr1 massivining arr2 massividagi takrorlanmas qismini qaytaruvchi kodni ko’rsating. np.setdiff1d(arr1,arr2) pd.setdiff1d(arr2,arr1) np.in1d(arr1,arr2) pd.in1d(arr2,arr1) arr1 massivini .npy fayl kengaytmada saqlash kodini ko’rsating. np.save("data.npy",arr1) np.savez("data.npy",arr1) pd.save("data.npy",arr1) pd.savez_compressed("data.npy",arr1) arr1 va arr2 massivlarini faylda saqlash uchun to’g’ri kodni ko’rsating. np.savez("data.npz",x=arr1,y=arr2) pd.savez("data.npz",x=arr1,y=arr2) np.save("data.npz",x=arr1,y=arr2) np.save("data.npy",x=arr1,y=arr2) array([2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7]) ko'rinishdagi massiv ustida unique funksiyasiga argument sifatida uzatadigan bo'lsak, natija qanday bo'ladi? array([2, 3, 4, 5, 6, 7]) array([2, 2,3,3, 4,4 ,5, 6, 7]) array([7,6,5,4,3,2]) array([1,2, 3, 4, 5, 6, 7]) array([0, 1, 2, 3]) massivi ustida cumsum metodini bajsak, eng oxirgi element qanday qiiymatga ega bo'lib qoladi? 6 5 4 0 1 where funksiyasining bajaradigan vazifasi qanday (tassavur qiling, a va b massivda qo'llanildi)? berilgan shartga ko\'ra, a yoki b massivning elementlarini qaytaruvchi funksiya berilgan shartga ko\'ra, a yoki b massivning elementlarini kattasini qaytaruvchi funksiya faqat shart bajarilmaganda bajariluvchi funksiya. To’g’ri javob berilmagan. Series obyektining qiymarlarini ko'rish uchun uning qaysi parametriga murojaat qilamiz. .values .np.values() pd.index np.index pandas kutubxonasi tarkibidagi ikki eng muhim ma'lumotlar turi qanday ataladi? Download 27.8 Kb. Do'stlaringiz bilan baham: |
1 2
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling