text stringlengths 226 34.5k |
|---|
How can I remove text within multi layer of parentheses python
Question: I have a python string that I need to remove parentheses. The standard way is
to use `text = re.sub(r'\([^)]*\)', '', text)`, so the content within the
parentheses will be removed.
However, I just found a string that looks like `(Data with in (Bo... |
How to configure Django to access remote MySQL db django.contrib.sites.RequestSite module missing
Question: I'm trying to set up a django app that connects to a remote MySQL db. I
currently have Django==1.10 and MySQL-python==1.2.5 installed in my venv. In
settings.py I have added the following to the DATABASES variabl... |
How can I optimize this python code - NO MEMORY?
Question: I wrote this python code:
from itertools import product
combo_pack = product("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890!&+*-_.#@", repeat = 8)
myfile = open("lista_combinazioni.txt","w")
for combo in combo_pa... |
Problems installing Python Pymqi package
Question: THis is my first post on this forum. If I am not complying with protocols,
please just let me know.
C:\>python --version
Python 2.7.11
OS: Windows version 7
WMQ: 8.2
I am trying to install Python **pymqi** package. After couple hours of tryin... |
Send scheduled emails with pyramid_mailer and apscheduler
Question: I've tried getting this to work but there must be a better way, any input is
welcome.
I'm trying to send scheduled emails in my python pyramid app using
pyramid_mailer (settings stored in .ini file), and apscheduler to set the
schedule.
I also use th... |
python: convert pywintyptes.datetime to datetime.datetime
Question: I am using pywin32 to read/write to an Excel file. I have some dates in Excel,
stored in format yyyy-mm-dd hh:mm:ss. I would like to import those into Python
as datetime.datetime objects. Here is the line of code I started with:
prior_da... |
Change a parent variable in subclass, then use new value in parent class?
Question: I'm just getting to grips with python, and am currently trying to change the
value of a Parent class variable using a subclass method. A basic example of
my code is below.
from bs4 import BeautifulSoup
import requests... |
Pandas Python - Finding Time Series Not Covered
Question: Hoping someone can help me out with this one because I don't even know where
to start.
Given a data frame that contains a series of start and end times, such as:
Order Start Time End Time
1 2016-08-18 09:30:00.000 2016-08... |
facedetection with opencv and python only detect eye region
Question: I wrote the script by looking at this website and it works perfectly but the
only problem when I run it on my computer is it only detects the eye region.
<https://pythonprogramming.net/haar-cascade-face-eye-detection-python-opencv-
tutorial/>
Below ... |
Formatting Lists into columns of a table output (python 3)
Question: I have data that is collected in a loop and stored under separate lists that
hold only the same datatypes (e.g. only strings, only floats) as shown below:
names = ['bar', 'chocolate', 'chips']
weights = [0.05, 0.1, 0.25]
costs =... |
python - Implementing Sobel operators with python without opencv
Question: Given a greyscale 8 bit image (2D array with values from 0 - 255 for pixel
intensity), I want to implement the Sobel operators (mask) on an image. The
Sobel function below basically loops around a given pixel,applies the
following weight to the ... |
how to read json file with pandas?
Question: I have scraped a website with scrapy and stored the data in a json file.
Link to the json file:
<https://drive.google.com/file/d/0B6JCr_BzSFMHLURsTGdORmlPX0E/view?usp=sharing>
But the json isn't standard json and gives errors:
>>> import json
>>> with o... |
Python: Division by larger numbers slower?
Question: Why does dividing by the larger factor pair result in slower execution?
My solution for
<https://codility.com/programmers/task/min_perimeter_rectangle/>
from math import sqrt, floor
# This fails the performance tests
def solution_slow(n):... |
PIL in Python complains that there are no 'size' attributes to a PixelAccess, what am I doing wrong?
Question: I am trying to program an application that will loop through every pixel of a
given image, get the rgb value for each, add it to a dictionary (along with
amount of occurences) and then give me rundown of the m... |
How do I write a python dictionary to an excel file?
Question: I'm trying to write a dictionary with randomly generated strings and numbers
to an excel file. I've almost succeeded but with one minor problem. The
structure of my dictionary is as follows:
Age: 11, Names Count: 3, Names: nizbh,xyovj,clier
... |
How to apply a formula to each cell of a numpy array
Question: I am trying to take an existing numpy array and apply a formula to each cell
of the array. I have the code below but it returns the following error.
Traceback (most recent call last): File "C:\gTemp\Text-1.py", line 5, in
myarray = 0.1236 * math.tan(myarray... |
Tor Browser with RSelenium in Linux/Windows
Question: Looking to use RSelenium and Tor using my Linux machine to return the Tor IP
(w/Firefox as Tor Browser). This is doable with Python, but having trouble
with it in R. Can anybody get this to work? Perhaps you can share your
solution in either Windows / Linux.
... |
GtkInfoBar doesn't show again after hide
Question: I'm hide Gtk widget, then try to show it, but none of the methods "show()",
"show_all()" or "show_now()" does't work. If not call "hide()" widget shows.
python 3.5.2
gtk3 3.20.8
pygobject-devel 3.20.1
test.py:
import gi
g... |
recursive import in python
Question: in logging.py in my python library there are the lines:
import logging
and:
from logging import DEBUG, INFO, WARNING, ERROR, CRITICAL
I don't understand the meaning of importing logging within logging.py and also
where (DEBUG, INFO, WARNING,... |
Python convert list to dict with multiple key value
Question: I have a list something like below and want to convert it to dict
my_list = ['key1=value1', 'key2=value2', 'key3=value3-1', 'value3-2', 'value3-3', 'key4=value4', 'key5=value5', 'value5-1', 'value5-2', 'key6=value6']
How can I convert ab... |
Python Problems Guess the Number Game
Question: I have made a guess the number python game for the terminal, but the game does
not recognize when the player wins and i dont understand why. here is my code:
from random import randint
import sys
def function():
while (1 == 1)... |
No module named 'matplotlib.pylot'
Question: I had installed Python 3.5 from anaconda distribution.
C:\Users\ananda>python
Python 3.5.2 |Anaconda 4.1.1 (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more inf... |
IMDbPY get the stars of a movie
Question: I was able to get the cast of the movie like this:
#!/usr/bin/env python
import imdb
ia = imdb.IMDb()
s_result = ia.search_movie('The Untouchables')
the_unt = s_result[0]
print the_unt['cast']
However, that gave all the _cast_ , i am loo... |
ImportError: No module named services Django
Question: I installed python 2.7 alongside my mac. I have a project running using Django
v1.9.4. Unfortunately `manage.py runserver` is throwing an error while running
failed because it couldn't find module named services.
From a shell:
Traceback (most recent... |
TypeError: super() takes at least 1 argument [Python 3]
Question: In the following codes, I kept on getting the same error although I rechecked
it for more than 15 minutes. For your info, I ran it on sublime text and the
error:
> TypeError: super() takes at least 1 argument (0 given)
The code is as shown below:
... |
Skulpt runit() button conflicting with CodeMirror?
Question: I am making an in-browser (static) Python editor with Skulpt and CodeMirror.
Here is the code for it so far:
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js" t... |
Parsing data from JSON with python
Question: I'm just starting out with Python and here is what I'm trying to do. I want to
access Bing's API to get the picture of the day's url. I can import the json
file fine but then I can't parse the data to extract the picture's url.
Here is my python script:
impor... |
Python Guessing game - incomplete code
Question: Can someone please help me re-design this code so that the program prompts the
user to choose Easy, Medium or Hard.
Easy: maxNumber = 10
Medium: maxNumber = 50
Hard: maxNumber = 100
It should choose a random number between 0 and the maxNumber... |
Python 3.4 ctypes message box doesn't open with other code included
Question: Normally this code works fine when called.
import ctypes
def message_box(title, text):
ctypes.windll.user32.MessageBoxW(0, text, title, 1)
But when it's used with other code it hangs at the line where mes... |
I can't install matplotlib
Question: Collecting matplotlib Using cached matplotlib-1.5.2.tar.gz Complete output
from command python setup.py egg_info:
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
... |
Pandas converts list of datetime values incorrectly
Question: I have a list of datetime values, and would like to convert the list into a
pandas.Series instance. The code boils down to the following:
from datetime import datetime
from datetime import timedelta
from dateutil import parser
... |
Kombu, RabbitMQ: Ack message more than once in a consumer mixin
Question: I have stumbled upon this problem [while I was documenting
Kombu](http://stackoverflow.com/documentation/python/drafts/6079) for the new
SO documentation project.
Consider the following Kombu code of a [Consumer
Mixin](http://docs.celeryproject.... |
Is there a way to do this in python?
Question: I have a list of integers. For example [2,3,4] and I want to expand the list
with outcomes of all possible multiplications of these integers. That would be
in this case 6,8,12,24. How would I do this? Keep in mind that the list I want
to do this with has 16 items so an alg... |
Python Looping through File and downloading Images
Question: I am trying to loop through a text file with different website links to
download the images. I also want them to have a unique file name. Just a loop
counter as you see so the three images would be `1.jpg`, `2.jpg`, `3.jpg`. Yet
I am only getting the last ima... |
numpy reshape confusion with negative shape values
Question: Always confused how numpy reshape handle negative shape parameter, here is an
example of code and output, could anyone explain what happens for reshape [-1,
1] here? Thanks.
Related document, using Python 2.7.
<http://docs.scipy.org/doc/numpy/reference/gene... |
Python2 - Summing "for" loop output
Question: I'm trying to make a script that takes a balances of multiple addresses from a
json file and adds them together to make a final balance.
This is the code so far -
import json
from pprint import pprint
with open('hd-wallet-addrs/addresses.json') ... |
Python - Kivy: AttributeError: 'super' object has no attribute '__getattr__' when trying to get self.ids
Question: I wrote a code for a kind of android lock thing, whenever I try to get an
specific ClickableImage using the id it raises the following error:
AttributeError: 'super' object has no attribute ... |
Python 2.7.8 for line iteration error
Question: I want to iterate over all lines in a file with the following script
import sys
infile = open("test.txt")
infile.read()
for line in infile
if line.find("This") != -1
print line
infile.close()
Unfortun... |
Unable to crawl some href in a webpage using python and beautifulsoup
Question: I am currently crawling a web page using Python 3.4 and bs4 in order to
collect the match results played by Serbia in Rio2016. So the url
[here](http://rio2016.fivb.com/en/volleyball/women/teams/srb-
serbia#wcbody_0_wcgridpadgridpad1_1_wcme... |
UDF (User Defined Function) python gives different answer in pig
Question: I want to write a UDF python for pig, to read lines from the file called like
#'prefix.csv'
spol.
LLC
Oy
OOD
and match the names and if finds any matches, then replaces it with white
space. here is my pytho... |
Why cant I do blob detection on this binary image
Question: First, now i am doing the blob detection by Python2.7 with Opencv. What i want
to do is to finish the blob detection after the color detection. i want to
detect the red circles(marks), and to avoid other blob interference, i want to
do color detection first, a... |
Troubles understanding finding elements in python selenium
Question: I'm trying to follow use find elements from <http://selenium-
python.readthedocs.io/locating-elements.html#locating-elements-by-class-name>;
however, they seem to work only half the time and usually on more simple
sites. I'm wondering why that is. For... |
How to count number of occurences of permutation (overlapping) in large text in python3?
Question: I am having a list of words and I'd like to find out how many time each
permutation occurs in this list of word. And I'd like to count overlapping
permutation also. So count() doesn't seem to be appropriate. for example: ... |
Extracting infromation from multiple JSON files to single CSV file in python
Question: I have a JSON file with multiple dictionaries:
{"team1participants":
[ {
"stats": {
"item1": 3153,
"totalScore": 0,
...
}
},
... |
Implement hashid in django
Question: I've been trying to implement
[hashids](https://github.com/davidaurelio/hashids-python) in django models. I
want to acquire hashid based on model's `id` like when model's `id=3` then
hash encoding should be like this: `hashid.encode(id)`. The thing is i can not
get id or pk until i ... |
allen brain institute - brain observatory example
Question: I'm trying to follow the example of [brain observatory ipython
notebook](https://alleninstitute.github.io/AllenSDK/_static/examples/nb/brain_observatory.html).
However, I became stuck loading the `nwb` file like below.
from allensdk.core.brain_... |
List index out of range error in web scraping
Question: I am now building a web-scraping program with Python 3.5 and bs4. In the code
below I tried to retrieve the data from two tables in the url. I succeed in
the first table, but error pops out for the second one. The error is
"IndexError: list index out of range" for... |
Multiprocessing does not see global variables?
Question: I have run into a strange behaviour at multiprocessing.
When i try to use a global variable in a function which is called from
multiprocessing it does not see a global variable.
Example:
import multiprocessing
def func(useless_variable):... |
django - UNIQUE CONSTRAINED FAILED error
Question: This is what my models.py looks like:
from django.db import models
from django.core.validators import RegexValidator
# Create your models here.
class Customer(models.Model):
customer_id = models.AutoField(primar... |
Web Scraping Python using Google Chrome extension
Question: Hi I am a Python newbie and I am webscrapping a webpage.
I am using the Google Chrome Developer Extension to identify the class of the
objects I want to scrape. However, my code returns an empty array of results
whereas the screenshots clearly show that that ... |
Spread function calls evenly over time in Python
Question: Let's say i have a function in Python and it's pretty fast so i can call it in
a loop like 10000 times per second.
I'd like to call it, for example, 2000 times per second but with even
intervals between calls (not just call 2000 times and wait till the end of ... |
How to extract the first numbers in a string - Python
Question: How do I remove all the numbers before the first letter in a string? For
example,
myString = "32cl2"
I want it to become:
"cl2"
I need it to work for any length of number, so 2h2 should become h2, 4563nh3
becomes n... |
django: RecursionError when initialize a object
Question: SO I am trying to build a simple shopping cart feature for my app, that simply
add, remove a piece of equipment, and display a list of current cart. Here are
my codes for this cart: (codes largely adopted from
<https://github.com/bmentges/django-cart>)
cart.py:... |
Dumping JSON directly into a tarfile
Question: I have a large list of dict objects. I would like to store this list in a tar
file to exchange remotely. I have done that successfully by writing a
json.dumps() string to a tarfile object opened in 'w:gz' mode.
I am trying for a piped implementation, opening the tarfile o... |
Getting an argument name as a string - Python
Question: I have a function that takes in a variable as an argument. That variable
happens to contain a directory, also holding a bunch of txt files.
I was wondering if there is a way for that variable to be taken as a string?
Not what's inside the variable, just the name ... |
Resize window without covering widget
Question: This Python-tkinter program uses the pack geometry manager to place a text
widget and a "quit" button in the root window -- the text widget is above the
button.
import tkinter as tk
root = tk.Tk()
txt = tk.Text(root, height=5, width=25, bg='lightblu... |
how can I get python's np.savetxt to save each iteration of a loop in a different column?
Question: This is an extremely basic code that does what I want... except with regard to
the writing of the text file.
import numpy as np
f = open("..\myfile.txt", 'w')
tst = np.random.random(5)
tst... |
Find and Edit Text File
Question: I'm looking to find if there is a way of automating this process. Basically I
have 300,000 rows of data needed to download on a daily basis. There are a
couple of rows that need to be edited before it can be uploaded to SQL.
Jordan || Michael | 23 | Bulls | Chicago
... |
Registering on PyPI test site command line ValueError
Question: Why is the below happening when I try to register my package with the test
site? It registers with the regular site just fine :/
This is what happens at my command line when I attempt to register with the
pypi test site:
PS C:\Users\Dave\De... |
How to plot bar graph interactively based on value of dropdown widget in bokeh python?
Question: I want to plot the bar graph based value of dropdown widget.
**Code**
import pandas as pd
from bokeh.io import output_file, show
from bokeh.layouts import widgetbox
from bokeh.models.widgets impo... |
List Accumulation with Append
Question: I want to generate or return an append-accumulated list from a given list (or
iterator). For a list like `[1, 2, 3, 4]`, I would like to get, `[1]`, `[1,
2]`, `[1, 2, 3]` and `[1, 2, 3, 4]`. Like so:
>>> def my_accumulate(iterable):
... grow = []
... ... |
How can I combine two FITS tables into a single table in new fits file?
Question: I have two fits file data (file1.fits and file2.fits). The first one
(file1.fits) consists of 80,700 important rows of data and another one is
140,000 rows. The both of them have the same Header.
$ python
>>> import pyf... |
Multiprocessing - Shared Array
Question: So I'm trying to implement multiprocessing in python where I wish to have a
Pool of 4-5 processes running a method in parallel. The purpose of this is to
run a total of thousand Monte simulations (250-200 simulations per process)
instead of running 1000. I want each process to w... |
Get read of ['\n'] in python3 with paramiko
Question: I've just started to do some monitoring tool in python3 and I wondered, if I
can get 'clear' number output through ssh. I've made some script:
import os
import paramiko
command = 'w|grep \"load average\"|grep -v grep|awk {\'print ($10+$11... |
Python & Google Places API | Want to get all Restaurants at a specific postion
Question: I want to get all restaurants in London by using python 3.5 and the module
"googlePlaces" with the Google Places API. I read the "googleplaces"
documentation and searched here. But I don't get it. Thats my Code so far:
... |
Python Unit-test Mocking, unable to patch `time` module that's being imported in `__init__.py`
Question: I've the following code in the **__init__.py** file
from time import sleep
from functools import wraps
def multi_try(func):
@wraps(func)
def inner(*args, **kwargs):
... |
Replacing multiple strings with regex in python for a file giving truncated string
Question: The following python code
import xml.etree.cElementTree as ET
import time
import fileinput
import re
ts = str(int(time.time()))
modifiedline =''
for line in fileinput.input("singleout... |
Problems when opening xlsx with openpyxl
Question: I have a xlsx file and I tried to load this file using openpyxl
from openpyxl import load_workbook
wb = load_workbook('/home/file_path/file.xlsx')
But I get this error:
"wb = load_workbook(new_file)"): expected string or buffer
... |
Python Decryption using private key
Question: I have an encrypted string. The Encryption is done using java code. I decrypt
the encrypted string using following java code
InputStream fileInputStream = getClass().getResourceAsStream(
"/private.txt");
byte[] bytes = ... |
Share a variable between two files?
Question: What is a mechanism in Python by which I can do the following:
file1.py:
def getStatus():
print status
file2.py:
status = 5
getStatus() # 5
status = 1
getStatus() # 1
The function and the variable are in two dif... |
How to pass 'self' parameter of one class to another class
Question: I am trying to incorporate matplotlib into tkinter by having multiple frames.
I need to pass the entry inputs from `StartPage` frame to update the plot in
`GraphPage` once the button in `StartPage` is clicked. Therefore, I'm trying
to bind the update ... |
Pythonic way to add values to a set within a dictionary
Question: Lets say i have a dictionary of sets:
d = {"foo":{1,2,3},
"bar":{3,4,5}}
Now lets say I want to add the value `7` to the set found within the key
`foo`. This would be easy:
d["foo"].add(7)
but what if... |
Selenium webdriver python find element by xpath - Could not find element
Question: I m trying to write a script with selenium webdriver python. When I try to do
a
find_element_by_xpath("//*[@id='posted_1']/div[3]")
it says
> NoElementFoundException.
Can someone please help me here?
Regards Bala... |
How do I set the DJANGO_SETTINGS_MODULE env variable?
Question: I'm trying to fix a bug I'm seeing in a django application where it isn't
sending mail. Please note that the application works great, it's only the mail
function that is failing. I've tried to collect error logs, but I can't come
up with any errors related... |
Why python UDF returns unexpected datetime objects where as the same function applied over RDD gives proper datetime object
Question: I am not sure if I am doing anything wrong so pardon me if this looks naive,
My problem is reproducible by the following data
from pyspark.sql import Row
df = sc.paral... |
python load zip with modules from memory
Question: So lets say I have a zip file with modules/classes inside. I then read this
file - read binary ("rb") to store it into memory. How would I take this zip
file in memory and load a module from it. Would I need to write an import hook
for this? One cannot simply run exec ... |
Python3.4 error - Cannot enable executable stack as shared object requires: Invalid argument
Question: I've been trying to install [OpenCV](http://opencv.org/) in a Bash on Windows
(Windows Subsystem for Linux, wsl) environment and it's been proving very
difficult.
I think I'm getting very close, but upon entering pyt... |
Python Pandas with sqlalchemy | Bulk Insert Error
Question: I was try to Insert my millions of records from **CSV** File to **MySQL** Database, by using **Python** | **Pandas** with **sqlalchemy**. Some time this insertion is interrupted before the completion or not even insert single row to Database.
My Code is :
... |
output on a new line in python curses
Question: I am using curses module in python to display output in real time by reading a
file. The string messages are output to the console using addstr() function
but I am not able to achieve printing to a newline wherever I need.
sample code:
import json
impo... |
python request post doesn't submit
Question: I have a problem with request.post, instead of returning the html code with
the results I get back the html code of the starting side.
import requests
def test(pdb):
URL = "http://capture.caltech.edu/"
r = requests.post(URL,files={"upfile": o... |
Pass just one field via AJAX with Flask
Question: I have a VERY simple HTML form with just one `<input type='text'>` field, an
email address, that I need to pass back to a Python script via AJAX. I can't
seem to receive the value on the other end. (And can all the JSON
encoding/decoding be avoided, since there's just o... |
Accessing rabbitmq running on local machine from docker container
Question: I want to test a docker image running a python script subscribing to a
rabbitmq queue. I have rabbitmq running on my local machine, and want to test
the docker container running on the same machine and have it subscribe to the
local rabbimq ser... |
I'm trying to get an excel sheet downloaded using python requests module and getting junk output
Question: I'm trying to download an excel file which is uploaded on a Sharepoint 2013
site.
My code is as follows:
import requests
url='https://<sharepoint_site>/<document_name>.xlsx?Web=0'
author = ... |
ImportError: No module named _mysql
Question: I'm trying to use the Python module MySQL-python to connect to an external
MySQL database from an AWS EC2 instance running amazon linux.
This is the code I'm trying to run:
db=_mysql.connect(host="hostname",user="dbuser",passwd="dbpassword",db="database")
... |
python package error when running from sublime
Question: I installed the python package `isochrones` using `pip install isochrones`.
When I type `from isochrones.dartmouth import Dartmouth_Isochrone` in the
`Sublime text editor` I get the following error:
from isochrones.dartmouth import Dartmouth_Isoch... |
SSL SYSCALL error: Bad file descriptor on Heroku with postgres and Celery
Question: I've been using Celery successfully with a Django site on Heroku but it's just
started generating the error below, which stops it running. It looks like it's
having trouble with postgres, but I'm stumped as to how to fix it, given it's
... |
Queue doesn't process all elements when there are many threads
Question: I have noticed that when I have many threads pulling elements from a queue,
there are less elements processed than the number that I put into the queue.
This is sporadic but seems to happen somewhere around half the time when I run
the following c... |
How to sort stopped EC2s by time using "state_transition_reason" variable? Python Boto3
Question: I am seeing a steep increase on my AWS account costs. The largest cost items
are: **EC2: 67% RDS: 12%**
I have more than 50 stopped EC2s. One of them has been sitting there in a
stopped state from September of the year 20... |
Why can't python's datetime.max survive a round trip through timestamp / fromtimestamp?
Question: In most cases I can round-trip datetimes to and from a timestamp as follows:
from datetime import datetime
dt = datetime(2016, 1, 1, 12, 34, 56, 789)
print(dt)
print(datetime.fromtimestamp(d... |
Python cant handle exceptions from zipfile.BadZipFile
Question: Need to handle if a zip file is corrupt, so it just pass this file and can go
on to the next.
In the code example underneath Im trying to catch the exception, so I can pass
it. But my script is failing when the zipfile is corrupt*, and give me the
"normal... |
My url template not work
Question: I have a problem with my template tag url. The redirect not work when i click
on button.
Django version => 1.9 Python version => 2.7
In my urls.py(main) i have:
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.st... |
Comparing Dates in SQLLite
Question: Hello Im currently doing a small project in python and sqllite and I have a
csv that has been imported into a database with values under table name :
Members.
Each member has a "Date Joined" field in the format m/dd/yy. Some example
formats are below:
**I cant change the values in... |
YAML file update and delete using python?
Question: I have a YAML file and it looks like below
test:
- exam.com
- exam1.com
- exam2.com
test2:
- examp.com
- examp1.com
- examp2.com
I like to manage this file using python. Task is, I like to add an entry under
"test... |
Pygame for Python 3 - "Setup.py build" command error
Question: I am following these directions:
<http://www.pygame.org/wiki/CompileUbuntu?parent=Compilation>
The instructions give the steps in installing Pygame for Python 3 on Ubuntu.
I am having no problems with it until i reach the `python3 setup.py build`
step. Th... |
'[08001][TPT] [ODBC SQL Server Wire Protocol driver] Invalid connection Data
Question: I have a python program that implies connecting to a teradata database. The
server name is defaulted. Two people can succesfully use the python program
but one person can't and gets the following error message:
'[08001... |
Why do Python and wc disagree on byte count?
Question: Python and `wc` disagree drastically on the byte count (length) of a given
string:
with open("commedia.pfc", "w") as f:
t = ''.join(chr(int(b, base=2)) for b in chunks(compressed, 8))
print(len(t))
f.write(t)
Output :... |
keep tracking time in while loop and interacting with other commands in python3
Question: So i created a while loop that the user input and an output is returned
choice = input()
while True:
if choice == "Mark":
print("Zuckerberg")
elif choice == "Sundar":
print(... |
Python script for searching variable strings between two constant strings
Question:
import re
infile = open('document.txt','r')
outfile= open('output.txt','w')
copy = False
for line in infile:
if line.strip() == "--operation():":
bucket = []
copy = True
... |
mongoDB: store audio files (Best way) using python
Question: I've a bunch of audio files (.wav) and I'd like know from you guys, what's the
best way to store them in mongoDB? What I'm doing today is, just storing the
path of the file.(as you can see below). But I think it's not good because I'm
creating a "fake referen... |
transform string column of a pandas data frame into 0 1 vectors
Question: `LabelEncoder` and `OneHotEncoder` works pretty good for numpy array, which
transform string into `0,1` based vectors.
My question is, is there a neat API to convert a column of a pandas data frame
into `0, 1` vectors? I showed my code and raw c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.