Skip to content

Tag: python-3.x

How to print KMeans intiatial parameters?

I am using PyCharm to run Kmeans using Iris data. When I run this, simply prints KMeans() But I would like it to print the following: How can this be accomplished? Answer Simply run kmeans.get_params(). This will print out the parameters (default or custom) used while instantiating the function in a dictionar…

Decode UTF-8 encoded Xcom value from SSHOperator

I have two Airflow tasks that I want to communicate. The SSHOperator returns the last line printed, in this case, “remote_IP”. However, the SSHOperator’s return value is encoded using UTF-8. How can the SSHOperator Read_remote_IP return value non-encoded? Also, how can the BashOperator Read_…

Sending email with smtplib library with Python

Sending email with smtplib library with the below Python program, however, I get a SMTPServerDisconnected: Connection unexpectedly closed error. Full error code below: When trying out port 587 for Google SMTP servers I get an authentication error, so I imagine 465 is the correct TLS port. I have also seen ano…