Re: Copying a row from a range of Excel files to another

2019-06-26 Thread Sayth Renshaw
Cecil Westerhof wrote: > I was asked to copy a certain line from about 300 Excel lines to a new > Excel file. That is not something I would like to do by hand and I > immediately thought: that should be possible with Python. > > And it is. I was surprised how fast I could write that with openpyx

Re: for line3 in myips matching too longer matches.

2019-06-26 Thread Sayth Renshaw
Chris Roberts wrote: > ### > CODE: >elif line1.rstrip(‘\n’) in line2.strip(‘\n’): >for line3 in myips: >print “###” >print “line1 is %s” % line1.rstrip(‘\n’) >print “line2 is %s” % line2.strip(‘\n’) > ### > OUT

Re: Copying a row from a range of Excel files to another

2019-06-26 Thread MRAB
On 2019-06-26 22:14, Cecil Westerhof wrote: MRAB writes: Does Workbook support the 'with' statement? If it does, then that's the best way of doing it. (Untested) with Workbook() as wb_out: for filepath in filepathArr: current_row = [] with load_workbook(

Re: for line3 in myips matching too longer matches.

2019-06-26 Thread Cameron Simpson
On 26Jun2019 14:21, Chris Roberts wrote: ### CODE: elif line1.rstrip(‘\n’) in line2.strip(‘\n’): for line3 in myips: print “###” print “line1 is %s” % line1.rstrip(‘\n’) print “line2 is %s” % line2.strip(‘\n’) ### OUT

Re: Copying a row from a range of Excel files to another

2019-06-26 Thread Cecil Westerhof
MRAB writes: > Does Workbook support the 'with' statement? > > If it does, then that's the best way of doing it. > > (Untested) > > with Workbook() as wb_out: > for filepath in filepathArr: > current_row = [] > > with load_workbook(filepath) as wb_in: >

for line3 in myips matching too longer matches.

2019-06-26 Thread Chris Roberts
### CODE: elif line1.rstrip(‘\n’) in line2.strip(‘\n’): for line3 in myips: print “###” print “line1 is %s” % line1.rstrip(‘\n’) print “line2 is %s” % line2.strip(‘\n’) ### OUTPUT: line1 is 10.10.168.2 line2 is

Re: Copying a row from a range of Excel files to another

2019-06-26 Thread MRAB
On 2019-06-26 13:15, Cecil Westerhof wrote: Cecil Westerhof writes: I was asked to copy a certain line from about 300 Excel lines to a new Excel file. That is not something I would like to do by hand and I immediately thought: that should be possible with Python. And it is. I was surprised ho

Re: Hiding a progressbar in tkinter

2019-06-26 Thread MRAB
On 2019-06-26 16:47, Cecil Westerhof wrote: I just started with GUI stuff in tkinter. I have a progressbar, but I want it to be only visible when it is used. So I tried the following: window = Tk() window.title(window_str) frame = Frame(window) frame.pack(side = "top", fill =

Re: Hiding a progressbar in tkinter

2019-06-26 Thread Wildman via Python-list
On Wed, 26 Jun 2019 17:47:39 +0200, Cecil Westerhof wrote: > I just started with GUI stuff in tkinter. I have a progressbar, but I > want it to be only visible when it is used. So I tried the following: > window = Tk() > window.title(window_str) > frame = Frame(window) > frame.pac

Re: Make sure the window title is visible in tkinter

2019-06-26 Thread Wildman via Python-list
On Wed, 26 Jun 2019 15:05:15 +0200, Cecil Westerhof wrote: >> OK, then I will have to live with it. I did find some references to a method where you first disable the Tkinter title bar using overrideredirect(True). Then you create a new title bar using a frame and canvas. You can then set the f

Re: Creating a Windows executable on a Linux system

2019-06-26 Thread David Sumbler
On Wed, 2019-06-26 at 13:41 +0200, Cecil Westerhof wrote: > I need to write a Python desktop program. I create it on a Linux > system, but it has to run on a Windows system. When looking at how to > create an executable it seems that you need to be on a Windows system > to create a Windows executab

Hiding a progressbar in tkinter

2019-06-26 Thread Cecil Westerhof
I just started with GUI stuff in tkinter. I have a progressbar, but I want it to be only visible when it is used. So I tried the following: window = Tk() window.title(window_str) frame = Frame(window) frame.pack(side = "top", fill = "both", expand = True) Button(window, text =

Re: Make sure the window title is visible in tkinter

2019-06-26 Thread Grant Edwards
On 2019-06-26, Cousin Stanley wrote: > You might try setting a given window geometry > to accomodate the long title > [...] > window.geometry( "%dx%d+%d+%d" % ( win_w , win_h , ofs_h , ofs_v ) ) > Maybe add a bit of extra space for users with different default > font sizes

Re: Creating a Windows executable on a Linux system

2019-06-26 Thread Grant Edwards
On 2019-06-26, Cecil Westerhof wrote: > [...] it seems that you need to be on a Windows system to create a > Windows executable. Is this true, or is it possible to create a > Windows executable on a Linux system? AFIAK, you have to use a Windows system to create a windows executable. In the pas

Re: Make sure the window title is visible in tkinter

2019-06-26 Thread Cousin Stanley
Cecil Westerhof wrote: > I need to write a desktop program. I choose to use tkinter. > > How can I make sure the window title is visible? For example > when I have the following code : > from tkinter import Button, filedialog, Label, messagebox, Tk > > > window = Tk() > wind

Re: Make sure the window title is visible in tkinter

2019-06-26 Thread Cecil Westerhof
Wildman writes: > On Wed, 26 Jun 2019 13:25:15 +0200, Cecil Westerhof wrote: > >> I need to write a desktop program. I choose to use tkinter. How can I >> make sure the window title is visible? For example when I have the >> following code: >> from tkinter import Button, filedialog, Labe

Re: Copying a row from a range of Excel files to another

2019-06-26 Thread Cecil Westerhof
Cecil Westerhof writes: > Is it necessary to close the workbooks to circumvent a resource > leak? Still like to know. When not necessary it is better not to cloes them I think. > Is it a problem when a workbook is closed two times? If so I need to > make sure that this is not possible. That i

Re: Creating a Windows executable on a Linux system

2019-06-26 Thread Cecil Westerhof
"Peter Heitzer" writes: > Cecil Westerhof wrote: >>I need to write a Python desktop program. I create it on a Linux >>system, but it has to run on a Windows system. When looking at how to >>create an executable it seems that you need to be on a Windows system >>to create a Windows executable. Is

Re: Make sure the window title is visible in tkinter

2019-06-26 Thread Wildman via Python-list
On Wed, 26 Jun 2019 13:25:15 +0200, Cecil Westerhof wrote: > I need to write a desktop program. I choose to use tkinter. How can I > make sure the window title is visible? For example when I have the > following code: > from tkinter import Button, filedialog, Label, messagebox, Tk > > >

Re: Copying a row from a range of Excel files to another

2019-06-26 Thread Cecil Westerhof
Cecil Westerhof writes: > I was asked to copy a certain line from about 300 Excel lines to a new > Excel file. That is not something I would like to do by hand and I > immediately thought: that should be possible with Python. > > And it is. I was surprised how fast I could write that with openpyx

Re: Creating a Windows executable on a Linux system

2019-06-26 Thread Peter Heitzer
Cecil Westerhof wrote: >I need to write a Python desktop program. I create it on a Linux >system, but it has to run on a Windows system. When looking at how to >create an executable it seems that you need to be on a Windows system >to create a Windows executable. Is this true, or is it possible to

Re: What type of error is it

2019-06-26 Thread Cecil Westerhof
Cecil Westerhof writes: > I am writing a GUI program with tkinter. One function I have is: > def select_dir(): > try: > directory = filedialog.askdirectory() > if directory == '': > messagebox.showinfo(info_str, canceled_report) > return > chdir

What type of error is it

2019-06-26 Thread Cecil Westerhof
I am writing a GUI program with tkinter. One function I have is: def select_dir(): try: directory = filedialog.askdirectory() if directory == '': messagebox.showinfo(info_str, canceled_report) return chdir(directory) filepathArr = sorted(g

Make sure the window title is visible in tkinter

2019-06-26 Thread Cecil Westerhof
I need to write a desktop program. I choose to use tkinter. How can I make sure the window title is visible? For example when I have the following code: from tkinter import Button, filedialog, Label, messagebox, Tk window = Tk() window.title('A long window title') Button (win

Creating a Windows executable on a Linux system

2019-06-26 Thread Cecil Westerhof
I need to write a Python desktop program. I create it on a Linux system, but it has to run on a Windows system. When looking at how to create an executable it seems that you need to be on a Windows system to create a Windows executable. Is this true, or is it possible to create a Windows executable

Copying a row from a range of Excel files to another

2019-06-26 Thread Cecil Westerhof
I was asked to copy a certain line from about 300 Excel lines to a new Excel file. That is not something I would like to do by hand and I immediately thought: that should be possible with Python. And it is. I was surprised how fast I could write that with openpyxl. My first try was not very neat,

Re: pandas split and melt()

2019-06-26 Thread Peter Otten
Sayth Renshaw wrote: > Peter Otten wrote: >> def explode_consultants(consultants): Should have called that split_consultants(); takes a string and >> consultants = (c.lstrip("#") for c in consultants.split(";")) splits by ";", removes leading "#" >> return (c for c in consult

Re: pandas split and melt()

2019-06-26 Thread Sayth Renshaw
> > Since I didn't find a cool shortcut I decided to use brute force: > > $ cat pandas_explode_column.py > import pandas as pd > > df = pd.DataFrame( > [ > [ > "2019-06-21 11:15:00", > "WNEWSKI, Joan;#17226;#BALIN, Jock;#18139;#DUNE, Colem;#17230;" >

File not able to link from drive

2019-06-26 Thread khandelwalrajat963
I am running a code to connect the google drive with google colab.But I have a issue after connection.My Files are not able to read by google colab even after link is established . I have to read files from google drive in Google colab My Code !pip install -U -q PyDrive from pydrive.auth impo

EuroPython 2019: Mobile Conference App available

2019-06-26 Thread M.-A. Lemburg
We are pleased to announce the mobile conference app for EuroPython 2019, again hosted on the Attendify platform: EuroPython 2019 Conference App * https://ep2019.europython.eu/events/conference-app/ * Engage with the conference and its attendees -

Re: pandas split and melt()

2019-06-26 Thread Peter Otten
Sayth Renshaw wrote: > Hi > > Having fun with pandas filtering a work excel file. > My current script opens selected and filters the data and saves as excel. > > import pandas as pd > import numpy as np > > log = pd.read_excel("log_dump_py.xlsx") > df = log.filter(items=['Completed', 'Priority'

Pytest share fixture data across the class methods

2019-06-26 Thread Arup Rakshit
Hi, I am using pytest to test my flask end points. I have grouped tests related to all unauthenticated access in a class as you see below: @pytest.mark.usefixtures("client_class") class TestUnauthorizedRecipesAcces: def test_update_a_recipe(self, create_recipe_record): recipe = creat

Re: pandas split and melt()

2019-06-26 Thread Sayth Renshaw
Update. Option 1. - This annihilates all text in the column leaving nothing. completed_tasks['Consultant'] = completed_tasks['Consultant'].str.rstrip('.#123') Option 2. - returns unhashable series list. output = completed_tasks[completed_tasks['Consultant']].str.contains(r'/\b[^\d\W]+\b/g')