Colin Ross | 4 Aug 16:43 2015
Picon

Plotting asymmetric error bars for a single point in matplotlib

Hi all,

Goal: To plot asymmetric x error bars for a single point using errorbar. I
am interested in displaying the inter quartile range (IQR) for a data set.

Code:

import numpy as np
import matplotlib.pyplot as plt

y = 1.0
data = np.random.rand(100)

median = np.median(data)
upper_quartile = np.percentile(data, 75)
lower_quartile = np.percentile(data, 25)
IQR = upper_quartile - lower_quartile

plt.errorbar(median, y, xerr=[lower_quartile ,upper_quartile], fmt='k--')

plt.savefig('IQR.eps')
plt.show()

Error:

Traceback (most recent call last):
  File "IQR.py", line 15, in <module>
    plt.errorbar(median, y, xerr=[0.5,0.75], fmt='k--')
  File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 2251, in
errorbar
(Continue reading)

Quiles, Stephanie | 4 Aug 05:55 2015

palindrome using stack and queue

Hello ,

 i have to write a palindrome tester using a stack and a queue. You will need to handle strings that may have
upper/lower case letters and white space between the letters. We will not include punctuation marks in
our strings. Here’s an example: The user inputs otto, you read the string in, you print out something
like “otto is a palindrome.” The user inputs r a   DA    r, you output “r a    DA    r is a palindrome.”
 
here iw the code i originally had which worked: 
def main():
    my_str = input("Enter a string: ")
    my_str2 = [c for c in my_str.lower() if c.isalpha()]
    rev_str = reversed(my_str2)
    # check if the string is equal to its reverse
    if list(my_str2) == list(rev_str):
        print(my_str,"is a palindrome")
    else:
        print(my_str, "is not a palindrome")


if __name__ == '__main__':
    main()

But they want us to use a stack and a queue so how would i go about doing that? Here are the stack and queue
classes 

class Stack:
    """Top of the stack is at the end of the list"""
def __init__(self):
    self._items = []

(Continue reading)

Lulwa Bin Shuker | 4 Aug 06:21 2015
Picon

Question

Dear Python tutor list ...

I'm currently learning Python through an online course but after learning
the basics of the language I need to apply what I learned on a real project
and start practicing it. How can I do that ?

Thanks,

Lulwa Bin Shuker
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

acolta | 3 Aug 22:55 2015
Picon

Python Certifications

Hi,

I am new in python, so just curios if there are any good and appreciated python certification
programs/courses ?

Cheers,
Andrei
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Dima Kulik | 3 Aug 20:15 2015
Picon

for loop for long numbers

 Hi to all.
Can you help me plz.
I want to make a for loop with a huge numbers.
for example:

for i in range (0,9000000000):
 make_some_code

but range and xrange cant operate with such big numbers. 
Can some on help me?
Thanks.

--

-- 
Dima Kulik
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Ali Moradi | 3 Aug 14:22 2015
Picon

How to show the listbox from sqlite and make it searchable?

hi, this is my code (
http://paste.pound-python.org/show/3DZoev97e1UkWFcATKYF/)

how can i show the two fields name "esperanto" and "english" in a listbox
positioned under the entry widget? i want the two fields to be beside
eachother like (abak/o     abacus)

and i want to make them searchable via the entry widget like a dictionary
app :)

thanks, i'm beginner so please modify my code.

and is there any good tutorial on using SQLite with tkinter and how to
desplay records on GUIs ?
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

matej taferner | 3 Aug 09:58 2015
Picon

question / decision tree

hi guys,

I am wondering if there is a python solution for the problem I am currently
dealing with.
I need to build a decision tree based questionnaire which helps users to
find the right answer.

As a final product of this decision tree "app" I need a clickable buttons
ready to be embedded into the website which will guide customer(s) to
desired answer(s).

Thanks,

Matej
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Quiles, Stephanie | 3 Aug 05:04 2015

find pickle and retrieve saved data

 how do i go about being able to add a feature to search for individual entries that have been saved into that
dictionary or else tell me that the name I entered is not found? 

Here is the code that i have so far…

import pickle
def main():
    infile = open("emails.dat", "rb")
    emails = pickle.load(infile)
    infile.close()
    name_search = input("Enter a name in the file for info: ")

    for name in emails:
        
        if name[0] == name_search:
            print("This is the info: ", info)
        return emails
    else:
        print("Entry not Found! Try again.")
main()


thanks for all the help and suggestions this is really helping me in trying to figure this out! 

Stephanie
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
(Continue reading)

Clayton Kirkwood | 3 Aug 04:14 2015
Picon

Windows "feature" I don't understand

In a former life, I played the part of a system manager in a number of Unix
environments, which I really liked. Now, I am stuck using Windows and don't
get into the innards much. I ran into a problem in my program, which we have
been discussing, which is windows-caused. I originally set my directory in
my code to /users/Clayton/Pictures by memory that that was the name of the
directory in windows. My code worked using the directory. I then noticed
that my "real" directory as listed by windows explorer was /users/Clayton/My
Pictures. I changed it in my code and nothing works. /users/Clayton/Pictures
doesn't show up in explorer even tho I've set to display hidden files,
system files, etc. I dropped down into dos and lo and behold, Picture exists
but there is no My Pictures. That explains why pictures worked, but I don't
understand the discrepancy for the differences, why My Pictures doesn't
work, etc. My Pictures is not a link in explorer.

Any shed light would be greatly appreciated.

TIA,

Clayton

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Nym City via Tutor | 3 Aug 01:13 2015

Writing back to same CSV in the next column

Hello,
Below is my program where I am reading a list of IPs from a CSV file and running it through the socket module.
The result of the computation is stored in a variable named ResolvedAddresses. However, there are some
that are not resolved and for those there is an exception.
The task that I am trying to complete now is taking the output of the ResolvedAddresses and the content of the
exception and write is back out to the same CSV file where the data is originally imported from. Ideally, I
would like this new information to be in the column B and match with column A.
Thank you in advance. And please let me know if what I am trying to accomplish is not clear and I'll try to
explain it better.

Here is the code: https://bpaste.net/show/01a412f72fa1

 Thank you.
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Clayton Kirkwood | 2 Aug 23:44 2015
Picon

scratching my head

Hey, been awhile, but I ran into os.walk and it fit what I needed to do for
an issue I've had for a long time: I have tons of pictures in my top
directory of pictures which are duplicated into properly named
subdirectories. Please see issues above my questions with large gaps below. 
TIA,
Clayton

#Program to find duplicated pictures in my picture directory tree
#Presumably, if the file exists in a subdirectory I can remove if from the
parent picture directory
#
#Clayton Kirkwood
#01Aug15

import os
from os.path import join,  getsize

main_dir = "/users/Clayton/Pictures"
directory_file_list = {}
duplicate_files = 0
top_directory_file_list = 0

for dir_path, directories, files in os.walk(main_dir):
    for file in files:
#        print( " file = ", file)
#       if( ("(\.jpg|\.png|\.avi|\.mp4)$") not in file.lower() ):
#        if(  (".jpg" or ".png" or ".avi" or ".mp4" )  not in file.lower()
):
#
#why don't these work?, especially the last one. How am I to capture all
(Continue reading)


Gmane