Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Time SQL Statement & Display Total
Post: Time SQL Statement & Display Total
Hello,
I'm experimenting with panda and sqlalchemy for the first time where I'm importing a CSV file into a SQL Server database.
from sqlalchemy import create_engine, func
import pandas as pd
import... |
|
anelliaf |
General Coding Help |
0 |
1,572 |
Feb-28-2020, 05:55 PM |
|
|
Thread: Result Set Count and Timing
Post: Result Set Count and Timing
Hello,
I'm experimenting with panda and sqlalchemy for the first time where I'm importing a CSV file into a SQL Server database.
from sqlalchemy import create_engine, func
import pandas as pd
impo... |
|
anelliaf |
Data Science |
0 |
1,191 |
Feb-27-2020, 07:33 PM |
|
|
Thread: Exception Hanlding of Lists
Post: RE: Exception Hanlding of Lists
This worked! Great advice and awesome code! Much appreciated! |
|
anelliaf |
General Coding Help |
2 |
2,126 |
Dec-06-2018, 12:02 PM |
|
|
Thread: Exception Hanlding of Lists
Post: Exception Hanlding of Lists
Hello,
I'm writing a program that will list available databases to a user based on their tnsnames.ora and then allow them to make a connection to one available. I want to return a message if they at... |
|
anelliaf |
General Coding Help |
2 |
2,126 |
Dec-05-2018, 04:12 PM |
|
|
Thread: Send Email Based on Condition
Post: RE: Send Email Based on Condition
That worked, thx! The output of the email is a bit off so I'm looking into that now. Also, I'm going to pass some arguments to their respective functions. Once I work on the formatting of the outpu... |
|
anelliaf |
General Coding Help |
2 |
5,714 |
Jun-05-2018, 05:34 PM |
|
|
Thread: Send Email Based on Condition
Post: Send Email Based on Condition
Hi All,
I have the following code which sends an email when Linux partitions reach a certain threshold:
from email.headerregistry import Address
from email.message import EmailMessage
from email.mim... |
|
anelliaf |
General Coding Help |
2 |
5,714 |
May-31-2018, 06:48 PM |
|
|
Thread: Email Results of Function
Post: RE: Email Results of Function
That was it, thx! Adding "return" makes total sense. With "print", it was outputting to stdout before the script sent the email.
Here's the final code:
from email.headerregistry import Address
fro... |
|
anelliaf |
General Coding Help |
10 |
6,364 |
May-30-2018, 12:00 PM |
|
|
Thread: Email Results of Function
Post: RE: Email Results of Function
Ok, that makes sense.
I added the line back but am receiving NONE again in the email body. Also, when I run the script from the command prompt the list value is displayed and it says the email was s... |
|
anelliaf |
General Coding Help |
10 |
6,364 |
May-29-2018, 07:21 PM |
|
|
Thread: Email Results of Function
Post: RE: Email Results of Function
So I removed the following from the create_email_message() function:
msg.set_content(body)I no longer receive an error. The email is sent but the body is blank. Looking into that now but any ideas ... |
|
anelliaf |
General Coding Help |
10 |
6,364 |
May-25-2018, 02:49 PM |
|
|
Thread: Email Results of Function
Post: RE: Email Results of Function
So I was able to put together the final piece of code but I'm still receiving error when passing the list to the body of the email.
from email.headerregistry import Address
from email.message import ... |
|
anelliaf |
General Coding Help |
10 |
6,364 |
May-24-2018, 05:14 PM |
|
|
Thread: Print Nested List Line by Line
Post: RE: Print Nested List Line by Line
Yes, thanks! I seen your other post after I posted my update.
Your advice/code gave me an understanding of what I was doing wrong. Much appreciated!
>>> for x,y in list_mounts:
... pr... |
|
anelliaf |
General Coding Help |
5 |
6,968 |
May-23-2018, 06:44 PM |
|
|
Thread: Print Nested List Line by Line
Post: RE: Print Nested List Line by Line
Update:
I was able to print the values, line by line:
>>> for i in range(len(list_mounts)):
... for j in range(len(list_mounts[i])):
... print(list_mounts[i][j], end = ' ')
... |
|
anelliaf |
General Coding Help |
5 |
6,968 |
May-23-2018, 06:38 PM |
|
|
Thread: Print Nested List Line by Line
Post: Print Nested List Line by Line
Hello,
I have the following nested list:
>>> print(list_mounts)
[['/var', 71], ['/u01', 61], ['/backups', 69]]I'd like to print the list with the following output:
Drive: /var Used ... |
|
anelliaf |
General Coding Help |
5 |
6,968 |
May-23-2018, 06:19 PM |
|
|
Thread: Email Results of Function
Post: RE: Email Results of Function
|
anelliaf |
General Coding Help |
10 |
6,364 |
May-23-2018, 03:53 PM |
|
|
Thread: Email Results of Function
Post: RE: Email Results of Function
Ok, I understand that part. How do I get the function to return the results to the body of the email? |
|
anelliaf |
General Coding Help |
10 |
6,364 |
May-23-2018, 02:02 PM |
|
|
Thread: Email Results of Function
Post: Email Results of Function
Hello,
I created the following function to return the results of Linux mounts points with over a certain percentage of used space:
>>> def mounts():
... devs = psutil.disk_partitions()
... |
|
anelliaf |
General Coding Help |
10 |
6,364 |
May-22-2018, 06:30 PM |
|
|
Thread: User Input to Choose from Dictionary
Post: RE: User Input to Choose from Dictionary
Awesome, got it! Thanks a lot for the example and advice. |
|
anelliaf |
General Coding Help |
9 |
25,671 |
Mar-27-2018, 02:22 PM |
|
|
Thread: User Input to Choose from Dictionary
Post: RE: User Input to Choose from Dictionary
All your points taken into consideration. I'm unsure which direction to go in order to present the user a list of values. I started off with a list but was having trouble presenting the values. Wit... |
|
anelliaf |
General Coding Help |
9 |
25,671 |
Mar-27-2018, 01:48 PM |
|
|
Thread: User Input to Choose from Dictionary
Post: RE: User Input to Choose from Dictionary
Finished code:
db_list = {
1: {'name': 'TEST11C'},
2: {'name': 'TEST12C'},
}
print("Databases:")
for x, y in db_list.items():
print(x, ':', db_list[x]['name'])
while True:
print("\nS... |
|
anelliaf |
General Coding Help |
9 |
25,671 |
Mar-27-2018, 01:13 PM |
|
|
Thread: User Input to Choose from Dictionary
Post: RE: User Input to Choose from Dictionary
Got it, thx for that!
Here's my fix:
while True:
print("Select a database: ")
name = int(input())
if name in db_list.keys():
name = int(name)
print("You have chosen: ", ... |
|
anelliaf |
General Coding Help |
9 |
25,671 |
Mar-27-2018, 11:22 AM |