Gender के अनुसार speeding outcomes की तुलना
जब किसी ड्राइवर को speeding के लिए रोका जाता है, तो बहुत लोग मानते हैं कि gender इस बात को प्रभावित करता है कि ड्राइवर को टिकट मिलेगा या चेतावनी. क्या आप इसके सबूत इस डेटासेट में ढूँढ सकते हैं?
सबसे पहले, आप speeding के लिए रोके गए ड्राइवरों के दो DataFrame बनाएँगे: एक में महिलाएँ होंगी और दूसरे में पुरुष.
फिर, हर gender के लिए, आप stop_outcome कॉलम का उपयोग करके यह निकालेंगे कि कितने प्रतिशत स्टॉप्स "Citation" (यानी टिकट) के रूप में और कितने "Warning" के रूप में हुए.
यह अभ्यास पाठ्यक्रम का हिस्सा है
pandas के साथ Police Activity का विश्लेषण
अभ्यास निर्देश
- एक DataFrame
female_and_speedingबनाएँ, जिसमें केवल वे महिला ड्राइवर हों जिन्हें speeding के लिए रोका गया था. - एक DataFrame
male_and_speedingबनाएँ, जिसमें केवल वे पुरुष ड्राइवर हों जिन्हें speeding के लिए रोका गया था. - महिलाओं के लिए stop outcomes की गिनती करें और उन्हें proportions में व्यक्त करें.
- पुरुषों के लिए stop outcomes की गिनती करें और उन्हें proportions में व्यक्त करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Create a DataFrame of female drivers stopped for speeding
female_and_speeding = ri[____]
# Create a DataFrame of male drivers stopped for speeding
male_and_speeding = ri[____]
# Compute the stop outcomes for female drivers (as proportions)
print(female_and_speeding.____)
# Compute the stop outcomes for male drivers (as proportions)
print(male_and_speeding.____)