1 answer

Append data dynamically to my xml SOAP message

I am calling an API by sending an xml request by doing a string formatting like this: data = '''<?xml version="1.0" encoding="utf-8"?> <SOAP-ENV:Envelope ...

1 answers | 8 secs ago by Raman Balyan on Stack Overflow stackoverflow.com
1 answer

how to “source” file into python script

I have a text file /etc/default/foo which contains one line: FOO="/path/to/foo" In my python script, I need to reference the variable FOO. What is the simplest way to "source" the file ...

3 answers

How do I configure PyCharm to run py.test tests?

I want to start writing unit tests for my Python code, and the py.test framework sounds like a better bet than Python's bundled unittest. So I added a "tests" directory to my project, and added ...

3 answers | 37 secs ago by Joe White on Stack Overflow stackoverflow.com
1 answer

Time format on Python tests

I would like to test if the format is something like '03:10 ~ 04:10' in python tests, however I have a problem getting it correctly. This is my code def test_activity_today_time_format(self): ...

1 answers | 52 secs ago by Fred Garcia on Stack Overflow stackoverflow.com
0 answers

Capstone Disassemble from Binary File in Python

first of all am very at this and sorry for my bad english. I need for a project in university to disasemble binary files. Therefore i should use capstone. I tried weeks with java but it didnt work so ...

1 answer

Does Pandas DataFrame bracket accessor [ ] prefer columns or rows?

I'm intrigued/confused by this example from the documentation: Selecting a single column, which yields a Series, equivalent to df.A In [23]: df['A'] Out[23]: 2013-01-01 0.469112 ...

1 answers | 1 min ago by djechlin on Stack Overflow stackoverflow.com
1 answer

Python regex - extend string

I got a .txt file, where the line is a sequence of names in a row: John Marry Joseph And I need to extend each of them with @company.com, to get this result: John@company.com ...

0 answers

Python 2.7 - Need to open .7z file with more files inside for reading

I'm learning with python and I can't find a working solution for my question. I have some .xml files in .7z file. I want to read the .xml files with python but I can't extract them on disk. I tried ...

5 answers

How to reverse a list of strings without reversed() or [::-1] in Python

I made a post about this recently but didn't go into proper detail and I don't really know how commenting works on this website so I thought I'd create another thread with proper detail (if that's ...

5 answers | 5 mins ago by Non Reg on Stack Overflow stackoverflow.com
0 answers

add legend to numpy array in matplot lib

I am plotting 2D numpy arrays using import numpy as np import matplotlib.pyplot as plt x = np.array([1,2,3]) y = np.array([[2,2.2,3],[1,5,1]]) plt.plot(x,y.T[:,:]) plt.legend() plt.show() I want a ...

1 answer

How to save to a text file an N dimensional array of arrays in columns python numpy

I have an array which consists of 80 arrays all with the size of 23, lets call it X. I want to save this to a text file in columns. but i get the error float argument required, not numpy.ndarray. I ...

1 answers | 6 mins ago by astrochris on Stack Overflow stackoverflow.com
0 answers

Updating Python PYQT label text

I want to update the label text through the input function so that the user is asked every 2 seconds to enter the new value of the label text. I tried to use the Thread method but it fails. I have ...

6 answers

How to randomly replace a string in a list

If I have something like this: L = ['-','-','-','-','-','-','-'] And let's say that I want to replace certain number of those strings. How do I randomly select a position within the list to replace ...

6 answers | 8 mins ago by user6137931 on Stack Overflow stackoverflow.com
1 answer

Given a list of tuples, return a string by concatenation

def display(xs): string1 = '' for i in range(len(xs)): string1+=str(xs[i])+'-' return string1 Given a list of tuples as xs = [(2,3),(4,4),(5,5),(6,6)].Return this list as a ...

1 answers | 8 mins ago by brian012 on Stack Overflow stackoverflow.com
3 answers

python recursive list questions

1.I came across this code: Python Recursion and list def search(lst, key): if not lst: # base case: list is empty return False elif lst[0] == key: # base case: current element ...

3 answers | 9 mins ago by Echo on Stack Overflow stackoverflow.com
1 answer

Time-efficient combination of numpy functions

I have two 3 dimensional numpy arrays A, B (size ~ (1000, 1000, 3) -> image processing) and the element-wise functions on it. The functions are sequentially: import numpy as np A = A ** 3 A = ...

1 answer

Out of memory filtering an HDF5 table in pandas

I have a 4+ Gb HDF5 table with rows corresponding to nodes in a tree-like structure. There are 3 salient columns: name, surname, weight. Surname logs the name of the parent of a given node, name is ...

0 answers

How to persist patsy DesignInfo?

I'm working on an application that is a "predictive-model-as-a-service", structured as follows: train a model offline periodically upload model parameters to a "prediction server" the prediction ...

2 answers

Python 3.4: Moving Through XML Tree

I'm pretty new to python and have never worked with xml so excuse my lack of expertise. I have a fairly long text file with an xml inside of it: - - - - Some Text Until This Point — — — - - - ...

2 answers | 11 mins ago by IronCode on Stack Overflow stackoverflow.com
0 answers

In place transform tree in python

What is the best practice for traversing a tree and modifying it in-place? This is what I have so far: class N: # Node def __init__(self, name, *children): self.name = name ...

5 answers

Python: How to import other Python files

How do I import other files in Python? How exactly can I import a specific python file like import file.py? How to import a folder instead of a specific file? I want to load a Python file ...

5 answers | 12 mins ago by Tamer on Stack Overflow stackoverflow.com
1 answer

Having trouble appending dictionary values to list in python

Dictionary So in python I have a dictionary that is composed of a name for the key and a class object associated with the name as the object. I need to append these objects to a list one by one from ...

1 answer

Removing numbers.

Im trying to remove numbers from a print statement, but when i do try, it doesn't. It actually adds extra lines that are unwanted. p=open('test1.txt','r') t=open('outChanger.txt','w') counter=0 for ...

1 answers | 12 mins ago by Julian on Stack Overflow stackoverflow.com
0 answers

Need an Example of Django big File upload with upload file handler method

In one of my django project I am trying to upload files. Files can be video files and can be big as 20 MB. I am trying to upload it with celery and upload_file_handler method given in django docs. ...

0 answers

Using 2 input csv files, and comparing them

i have two funcions that recive one csv file each. like this def cars(file_one): with open(file_one, 'rU') as car_file: reader = csv.DictReader(car_file, delimiter=';') result = [] ...

1 answer

Matplotlib: Format for increasing Figsize, given code layout

I have the following code in my Jupyter notebook. I have tried several different ways to change the figsize of the figure that I have found on the internet so far, but nothing seems to work. Also, ...

9 answers

Delete column from pandas DataFrame

When deleting a column in a DataFrame I use: del df['column_name'] and this works great. Why can't I use: del df.column_name As you can access the column/Series as df.column_name, I expect this ...

9 answers | 18 mins ago by John on Stack Overflow stackoverflow.com
1 answer

How to encrypt a variable with the cryptography module?

I'm not sure if any of you are familiar with the cryptography module, but I'm trying to encrypt a variable that stands for a string. For example: string = input('String here') The example they ...

1 answer

subprocess.CalledProcessError In python when using unrar

Python IDLE shows an error when I am trying to extract files using winrar(UnRAR.exe): "Traceback (most recent call last): File "<pyshell#32>", line 1, in <module> ...

5 answers

Removing white space from txt with python

I have a .txt file (scraped as pre-formatted text from a website) where the data looks like this: B, NICKOLAS CT144531X D1026 JUDGE ANNIE WHITE JOHNSON ANDREWS VS ...

15 30 50 per page
1 2 3