10a incorporating data into chatbots

Cards (7)

  • Correlational analysis

    The p value indicates whether the correlation is significant
  • How to create horizontal bars in Seaborn histograms
    • my_plot = sns.histplot(data = df, y = 'column')
  • Displaying data within a dataframe
    1. Use display() instead of print()
    2. Add .values[0] to print a specific value from the dataframe
  • Displaying plots within a chatbot
    1. Import a specific module within matplotlib
    2. Import a library called time
    3. Add two new lines to our chatbot: the first forces Python to show the plot, the second adds in a brief delay before continuing with the rest of the chatbot
  • Showing images within a chatbot
    1. Add relevant image to Drive
    2. Connect Colab to Drive
    3. Import the IPython and time libraries
    4. Use the following syntax: path = '/content/drive/My Drive/etc/image.jpg', display(Image(filename = path)), time.sleep(.5)
  • Calling functions within dictionaries
    1. Create a dictionary that pairs menu options with relevant functions
    2. Use the syntax: outputs = menu_dictionary[key](inputs)
  • Inserting a delay between printed messages

    Use the time.sleep(n) function, where n is the number of seconds to pause