शुरू करेंमुफ़्त में शुरू करें

सभी predictor insight graph टेबल्स को ग्रुप करना

पिछले अभ्यास में, आपने एक फंक्शन बनाया था जो किसी दिए गए वैरिएबल के लिए predictor insight graph टेबल इस प्रकार निकालता है:

pig_table = create_pig_table(basetable, "target","variable")

यदि आप एक साथ कई वैरिएबल्स के लिए predictor insight graph टेबल निकालना चाहते हैं, तो उन्हें dictionary में स्टोर करना अच्छा रहता है. आप dictionary = {} से नई dictionary बना सकते हैं, किसी key के साथ एलिमेंट जोड़ सकते हैं dictionary["key"] = value, और key का उपयोग करके एलिमेंट प्राप्त कर सकते हैं print(dictionary["key"]).

यह अभ्यास पाठ्यक्रम का हिस्सा है

Python में प्रिडिक्टिव एनालिटिक्स परिचय

पाठ्यक्रम देखें

अभ्यास निर्देश

  • एक खाली dictionary pig_tables बनाएँ.
  • हर वैरिएबल के लिए एक predictor insight graph टेबल बनाएँ.
  • हर वैरिएबल के लिए, इस predictor insight graph टेबल को dictionary में जोड़ें, जहाँ key वैरिएबल का नाम हो.
  • disc_time_since_last_gift की predictor insight graph टेबल प्रिंट करें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# Create the list of variables for our predictor insight graph tables
variables = ["income","gender","disc_mean_gift","disc_time_since_last_gift"]

# Create an empty dictionary
pig_tables = ____

# Loop through the variables
for variable in variables:
  
    # Create a predictor insight graph table
    pig_table = ____(basetable, ____, ____)
    
    # Add the table to the dictionary
    pig_tables[____] = ____

# Print the predictor insight graph table of the variable "disc_time_since_last_gift"
print(pig_tables["____"])
कोड संपादित करें और चलाएँ