Pengantar ilmu data dalam solusi penugasan minggu 1 python

Untuk tugas ini, Anda akan melihat data tahun 2017 tentang imunisasi dari CDC. File data Anda untuk penugasan ini ada di assets/NISPUF17. csv. Panduan pengguna data untuk ini, yang Anda perlukan untuk memetakan variabel dalam data ke pertanyaan yang diajukan, tersedia di aset/NIS-PUF17-DUG. pdf. Catatan. Anda mungkin harus pergi ke pohon Jupyter Anda (klik pada gambar Coursera) dan arahkan ke folder aset tugas 2 untuk melihat file PDF ini)

pertanyaan 1

Write a function called

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2 which returns the proportion of children in the dataset who had a mother with the education levels equal to less than high school (<12), high school (12), more than high school but not a college graduate (>12) and college degree.

Fungsi ini harus mengembalikan kamus dalam bentuk (gunakan angka yang benar, jangan membulatkan angka)

1
2
3
4
{"less than high school":0.2,
"high school":0.4,
"more than high school but not college":0.2,
"college":0.2}

Kode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def proportion_of_education():
# your code goes here
# YOUR CODE HERE
# raise NotImplementedError()
import pandas as pd
import numpy as np
df = pd.read_csv("assests/NISPUF17.csv", index_col=0)
EDUS=df['EDUC1']
edus=np.sort(EDUS.values)
poe={"less than high school":0,
"high school":0,
"more than high school but not college":0,
"college":0}
n=len(edus)
poe["less than high school"]=np.sum(edus==1)/n
poe["high school"]=np.sum(edus==2)/n
poe["more than high school but not college"]=np.sum(edus==3)/n
poe["college"]=np.sum(edus==4)/n
return poe
1
2
3
4
5
6
assert type(proportion_of_education())==type({}), "You must return a dictionary."
assert len(proportion_of_education()) == 4, "You have not returned a dictionary with four items in it."
assert "less than high school" in proportion_of_education().keys(), "You have not returned a dictionary with the correct keys."
assert "high school" in proportion_of_education().keys(), "You have not returned a dictionary with the correct keys."
assert "more than high school but not college" in proportion_of_education().keys(), "You have not returned a dictionary with the correct keys."
assert "college" in proportion_of_education().keys(), "You have not returned a dictionary with the correct keys."

结果

Pengantar ilmu data dalam solusi penugasan minggu 1 python


Pertanyaan 2

Mari jelajahi hubungan antara diberi ASI saat masih kecil dan mendapatkan vaksin influenza musiman dari penyedia layanan kesehatan. Kembalikan sejumlah rata-rata jumlah vaksin influenza untuk anak-anak yang kami tahu menerima ASI saat masih kecil dan mereka yang tahu tidak

Fungsi ini harus mengembalikan tuple dalam bentuk (gunakan nomor yang benar

1
_
(2.5, 0.1)

Kode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def average_influenza_doses():
# YOUR CODE HERE
# raise NotImplementedError()
import pandas as pd
import numpy as np
df = pd.read_csv("assests/NISPUF17.csv", index_col=0)

cbf_flu=df.loc[:,['CBF_01','P_NUMFLU']]


cbf_flu1=cbf_flu[cbf_flu['CBF_01'] ==1].dropna()
cbf_flu2=cbf_flu[cbf_flu['CBF_01'] ==2].dropna()

flu1=cbf_flu1['P_NUMFLU'].values.copy()
flu1[np.isnan(flu1)] = 0
f1=np.sum(flu1)/len(flu1)

flu2=cbf_flu2['P_NUMFLU'].values.copy()
flu2[np.isnan(flu2)] = 0
f2=np.sum(flu2)/len(flu2)

aid =(f1,f2)
return aid
1
{"less than high school":0.2,
"high school":0.4,
"more than high school but not college":0.2,
"college":0.2}
1

结果

Pengantar ilmu data dalam solusi penugasan minggu 1 python


## Pertanyaan 3 Akan menarik untuk melihat apakah ada bukti hubungan antara efektivitas vaksin dan jenis kelamin anak. Hitung rasio jumlah anak yang tertular cacar air tetapi divaksinasi (setidaknya satu dosis varicella) versus mereka yang divaksinasi tetapi tidak tertular cacar air. Kembalikan hasil berdasarkan jenis kelamin

Fungsi ini harus mengembalikan kamus dalam bentuk (gunakan angka yang benar)

{"less than high school":0.2,
"high school":0.4,
"more than high school but not college":0.2,
"college":0.2}
2
{"less than high school":0.2,
"high school":0.4,
"more than high school but not college":0.2,
"college":0.2}
3

Catatan. Untuk membantu verifikasi, nilai

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
_3 yang dicari autograder dimulai dengan angka
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
4

Kode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{"less than high school":0.2,
"high school":0.4,
"more than high school but not college":0.2,
"college":0.2}
5
1
{"less than high school":0.2,
"high school":0.4,
"more than high school but not college":0.2,
"college":0.2}
7

结果

Pengantar ilmu data dalam solusi penugasan minggu 1 python


Pertanyaan 4

Korelasi adalah hubungan statistik antara dua variabel. Jika kita ingin mengetahui apakah vaksin bekerja, kita dapat melihat korelasi antara penggunaan vaksin dan apakah itu menghasilkan pencegahan infeksi atau penyakit [1]. Dalam pertanyaan ini, Anda akan melihat apakah ada korelasi antara pernah terkena cacar air dan jumlah dosis vaksin cacar air yang diberikan (varicella)

Beberapa catatan tentang menafsirkan jawabannya.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
5 adalah
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
6 (untuk ya) atau
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
7 (untuk tidak), dan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
8 adalah jumlah dosis vaksin varicella yang telah diberikan kepada seorang anak. Korelasi positif (mis. g. ,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
_9) berarti bahwa peningkatan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
5 (yang berarti lebih banyak tidak) juga akan meningkatkan nilai
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
8 (yang berarti lebih banyak dosis vaksin). Jika ada korelasi negatif (mis. g. ,
def proportion_of_education():
# your code goes here
# YOUR CODE HERE
# raise NotImplementedError()
import pandas as pd
import numpy as np
df = pd.read_csv("assests/NISPUF17.csv", index_col=0)
EDUS=df['EDUC1']
edus=np.sort(EDUS.values)
poe={"less than high school":0,
"high school":0,
"more than high school but not college":0,
"college":0}
n=len(edus)
poe["less than high school"]=np.sum(edus==1)/n
poe["high school"]=np.sum(edus==2)/n
poe["more than high school but not college"]=np.sum(edus==3)/n
poe["college"]=np.sum(edus==4)/n
return poe
_2), menunjukkan bahwa pernah terkena cacar air berhubungan dengan peningkatan jumlah dosis vaksin

Juga,

def proportion_of_education():
# your code goes here
# YOUR CODE HERE
# raise NotImplementedError()
import pandas as pd
import numpy as np
df = pd.read_csv("assests/NISPUF17.csv", index_col=0)
EDUS=df['EDUC1']
edus=np.sort(EDUS.values)
poe={"less than high school":0,
"high school":0,
"more than high school but not college":0,
"college":0}
n=len(edus)
poe["less than high school"]=np.sum(edus==1)/n
poe["high school"]=np.sum(edus==2)/n
poe["more than high school but not college"]=np.sum(edus==3)/n
poe["college"]=np.sum(edus==4)/n
return poe
_3 adalah probabilitas bahwa kita mengamati korelasi antara
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
5 dan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
8 yang lebih besar dari atau sama dengan nilai tertentu yang terjadi secara kebetulan.
def proportion_of_education():
# your code goes here
# YOUR CODE HERE
# raise NotImplementedError()
import pandas as pd
import numpy as np
df = pd.read_csv("assests/NISPUF17.csv", index_col=0)
EDUS=df['EDUC1']
edus=np.sort(EDUS.values)
poe={"less than high school":0,
"high school":0,
"more than high school but not college":0,
"college":0}
n=len(edus)
poe["less than high school"]=np.sum(edus==1)/n
poe["high school"]=np.sum(edus==2)/n
poe["more than high school but not college"]=np.sum(edus==3)/n
poe["college"]=np.sum(edus==4)/n
return poe
_3 kecil berarti bahwa korelasi yang diamati sangat tidak mungkin terjadi secara kebetulan. Dalam hal ini,
def proportion_of_education():
# your code goes here
# YOUR CODE HERE
# raise NotImplementedError()
import pandas as pd
import numpy as np
df = pd.read_csv("assests/NISPUF17.csv", index_col=0)
EDUS=df['EDUC1']
edus=np.sort(EDUS.values)
poe={"less than high school":0,
"high school":0,
"more than high school but not college":0,
"college":0}
n=len(edus)
poe["less than high school"]=np.sum(edus==1)/n
poe["high school"]=np.sum(edus==2)/n
poe["more than high school but not college"]=np.sum(edus==3)/n
poe["college"]=np.sum(edus==4)/n
return poe
3 harus sangat kecil (akan diakhiri dengan
def proportion_of_education():
# your code goes here
# YOUR CODE HERE
# raise NotImplementedError()
import pandas as pd
import numpy as np
df = pd.read_csv("assests/NISPUF17.csv", index_col=0)
EDUS=df['EDUC1']
edus=np.sort(EDUS.values)
poe={"less than high school":0,
"high school":0,
"more than high school but not college":0,
"college":0}
n=len(edus)
poe["less than high school"]=np.sum(edus==1)/n
poe["high school"]=np.sum(edus==2)/n
poe["more than high school but not college"]=np.sum(edus==3)/n
poe["college"]=np.sum(edus==4)/n
return poe
8 menunjukkan angka yang sangat kecil)

[1] Ini bukan gambaran lengkapnya, karena kita tidak melihat kapan dosis diberikan. Ada kemungkinan anak-anak menderita cacar air dan kemudian orang tua mereka pergi untuk mendapatkan vaksin. Apakah kumpulan data ini memiliki data yang kami perlukan untuk menyelidiki waktu pemberian dosis?

Bagaimana cara saya berlatih Python untuk Ilmu Data?

Cara Mempelajari Python untuk Ilmu Data .
Langkah 1. Pelajari dasar-dasar Python. Semua orang mulai di suatu tempat. .
Langkah 2. Berlatih dengan pembelajaran langsung. .
Langkah 3. Pelajari perpustakaan ilmu data Python. .
Langkah 4. Bangun portofolio ilmu data saat Anda mempelajari Python. .
Langkah 5. Terapkan teknik ilmu data tingkat lanjut

Apa topik dalam Python untuk Ilmu Data?

Konsep Python Teratas yang Perlu Diketahui Sebelum Mempelajari Ilmu Data .
Bilangan Bulat dan Angka Mengambang dengan Python
String dengan Python
Nilai Boolean dengan Python
Operator aritmatika dengan Python
Operator Perbandingan dengan Python
Operator Logika dengan Python
Operator Keanggotaan dengan Python
Pemformatan F-string dengan Python

Bagaimana cara menguasai Python untuk media Ilmu Data?

10 Langkah Untuk Menguasai Python Untuk Ilmu Data. .
Belajar Python. .
Pahami Dasarnya. .
Memahami Topik Lanjutan Dan Mengonsepkan Konsep Penting Ini. .
Kode Terus-Menerus. .
Kerjakan Beberapa Proyek Keren. .
Memahami Mengapa Python Untuk Ilmu Data. .
Mempelajari Perpustakaan Ilmu Data Dasar

Seberapa baik Python untuk Ilmu Data?

Ini adalah salah satu bahasa terbaik yang digunakan oleh ilmuwan data untuk berbagai proyek/aplikasi ilmu data . Python menyediakan fungsionalitas hebat untuk menangani matematika, statistik, dan fungsi ilmiah. Ini menyediakan perpustakaan yang bagus untuk menangani aplikasi ilmu data.