text stringlengths 226 34.5k |
|---|
Python - Get waveform/amplitude of mp3
Question: I was hoping I could find a way to get the amplitude data from an mp3 in
python. Similar to audacity but I do not want a visual, a simple array of
values will do. I want my code to react to sound at certain points when it
gets louder. I am using pygame to play the audio ... |
Use python file/function across multiple local projects
Question: I have multiple python projects and each of them has a utility file, all of
them with the same functions.
How can I set up some sort of local python library which I can import to all
my local projects? I know rodeo has some functionality that you can us... |
Rotate the image via opencv in my defined function with Python
Question: I would like to rotate an image in my defined function and save the result in
parameter for extra use in main function.
The codes are as below:
import cv2
def rotate(img1, img2): # rotate img1 and save it in img2
... |
How can I improve my quick sort algorithim (Python)
Question: After reading about the quick sort algorithim, I decided to write my own
implementation before looking at any code. The code below is what I came up
with. Upon comparing my code with other implementations I have observed that
rather than returning the sorted... |
Creating heavily nested python dictionaries in a clean programmatic way
Question: I am using a series of functions to populate a heavily nested dictionary. I am
wondering if there is a cleaner way to do this than just long assignment
string as shown in the example below.
outputdict = {}
outputdict['x... |
ipdb is triggering ImportError
Question: ipdb is triggering an import error for me when I run my Django site locally.
I'm working on Python 2.7 and within a virtual environment.
`which ipdb` shows the path `(/usr/local/bin/ipdb)`, as does `which ipython`,
which surprised me since I thought it should show my venv path ... |
How to pull from multiple lists to make a new directory
Question: I'm trying to pull data from two different lists in order to make a new
directory. But Python says that the second list `queue` is not defined when I
try to run it.
import csv
import time
import os, sys
from datetime import dat... |
Import Pandas from a path
Question: I created a program to filter out rows of data that have empty cells, however,
the people that will be using this program do not have any libraries
installed, they only have Python 2.7. Is there a way to import Pandas via a
path from a network drive? I looked up similar questions, bu... |
"Fast" interactive plot of a 2d numpy array in python
Question: I have a need to visualize a 2d numpy array in python. Not a contour plot, not
a surface plot. Plot a point on a z axis for every (x,y) element in the 3d
array. My data is a 1024 x 1024 array, but I suppose I could decimate it if I
had to. I need to be abl... |
Confirmation when installing with pip globally
Question: Sometimes when working with Python projects one can forget to activate a
virtual environment.
Is there a way to get an explicit confirmation when installing Python modules
with pip to the global scope instead of a virtual environment?
Answer: You can try to wr... |
Trying do post request using python
Question: I'm trying to make http post request using python. Also I need `totp`
authentication and for this I'm using `pyotp`. For the request I'm using
Requests library. But the code doesn't work and I don't know where the mistake
is. Do you have ideas? I'm using python 3.5.
This i... |
IndexError: list index out of range in python, know the meaning, but don't understand why this happens
Question: I have the following code and I call the program writing:
python new.py -s 13 -p 5
But then, in line 63 I get the following error. I know what it means but I
can't understan why.
... |
Allowing for possible unknown file names to be processed in a python script
Question: I am using a script that overlays an input pdf onto another that is
essentially a letterhead. However, I am not sure how to allow for the process
to be automated to allow for many files to be processed one at a time, without
previousl... |
ValueError: invalid literal for int() with base 10
Question: I am a beginner in python. I came across this question in codewars.
_Jaden is known for some of his philosophy that he delivers via Twitter. When
writing on Twitter, he is known for almost always capitalizing every word.
Your task is to convert strings to ho... |
Python class is created when module is imported
Question: I have a Python module that is written like so.
SomeClasses.py
class A():
def __init__(self):
print "Hi! A is instantiated!"
class B():
def __init__(self):
print "Hi! B is instantiated!"
... |
Tensorflow gradient is always zero
Question: I have written a small Tensorflow program which convolves an image patch by
the same convolution kernel `num_unrollings` times in a row, and then attempts
to minimize the mean squared difference between the resulting values and a
target output.
However, when I run the model... |
Plot variable value instead of name in Python
Question: I have a large number of files with data about specific dates but with random
(ugly) names that I'd like to assign to a more structured string "infile" that
I can then use to refer to the original filename. To be concrete, in the
following code sample:
... |
Is there a way to count the number of elements of a certain name in an xml file using Python?
Question: I'm using Python 3.4 on a Windows 64-bit machine.
I currently have a xml file which has multiple hierarchies. There are a number
of elements going by the name "paragraph" in the xml tree. But they might be
on differ... |
python multissh pool on windows
Question: Trying to get a process pool to work on windows but after asking me the
password it again asks me the password.
import os
import sys
import paramiko
import getpass
import socket
from multiprocessing import Pool
def processFunc(h... |
How can I create Dictionary in Python from file, where values are a list
Question: I have a txt file and I want to read values into a dictionary. Different from
common dictionary, the value of each `key` is a value pair, for example:
tiger eat meat
tiger eat people
rabbit eat carrot
people ca... |
Pandas Dataframe has no Plot function
Question: I'm trying to call `df.plot.scatter(...)` as shown
[here](http://pandas.pydata.org/pandas-docs/stable/visualization.html#scatter-
plot), where `df` is a `pandas.Dataframe` object.
But my IDE can't suggest any plot function when I initiate suggestions (though
it can sugge... |
pandas read_csv is putting all values in one column and one row
Question: I've sought out an answer on multiple forums and YouTube but to no avail,
sorry in advance if it is widely available and my keywords just weren't right.
I'm attempting to execute a simple pandas.read_csv('.csv',sep=','). However
the output I'm r... |
How to find out if a class exists on an OrientDB using PyOrient?
Question: How is it possible to find out if a class exists; this allowing the prevention
of a 'class x already exists in current database' error message?
I have seen the following
[Question](https://stackoverflow.com/questions/28288268/check-class-creati... |
graceful interrupt of while loop in ipython notebook
Question: I'm running some data analysis in ipython notebook. A separate machine
collects some data and saves them to a server folder, and my notebook scans
this server periodically for new files, and analyzes them.
I do this in a while loop that checks every second... |
Mocking download of a file using Python requests and responses
Question: I have some python code which successfully downloads an image from a URL,
using [requests](http://docs.python-requests.org/en/master/), and saves it
into `/tmp/`. I want to test this does what it should. I'm using
[responses](https://github.com/ge... |
How do I use a variable as a function name in python
Question: How do I use a variable as a function name so that I can have a list of
functions and initialize them in a loop. I'm getting the error I expected
which is str object is not callable. But I don't know how to fix it. Thanks.
#Open protocol conf... |
Code transformation from BS4 to lxml parser
Question: I am working on a project to extract specific information from locally stored
HTML files by using BS4. As I do have a considerably big amount of files (>1
Million) speed and performance is the key for having a useful code browsing
through all files. Until now I am w... |
Python: read a text file and copy/paste directories listed in it to a new directory
Question: I am trying to read a .txt file that lists directory names and copy/paste the
listed directories into a new directory. I am pretty close to figuring it out
but need a function that copies the directory (not only its contents).... |
Django model instance full_clean method, is this right?
Question: What I want to do, is write code that will allow me to bulk-load Django object
instances from a csv file. Obviously I should check all the data first before
saving anything.
tl;dr: the full_clean() method doesn't catch an impending attempt to save None
... |
Extending snake in turtle graphics snake game
Question: So I'm working on a snake game in python's turtle graphics and I'm required to
use turtle. So Everything is working out fine except I just need the snake to
extend by one as it eats the objective. Can somebody please help.
from turtle import *
i... |
How to flag the most efficient way a column of a dataframe by values of another dataframe's in python/pandas?
Question: I've got a dataframe "A" (~500k records). It contains two columns:
"fromTimestamp" and "toTimestamp".
I've got a dataframe "B" (~5M records). It has some values and a column named
"actualTimestamp".
... |
Checking if global variables are defined in bottle
Question: Im trying to use bottle to update information on a site fed in from commands
in a chat bot but am struggling to get information from one route to another
while checking if the variables are defined.
It works fine until I add:
if 'area' not ... |
Execute multiple independent statements in SQLAlchemy Core?
Question: I'm using SQLAlchemy Core to run a few independent statements. **The
statements are to separate tables and unrelated**. Because of that I can't use
the standard `table.insert()` with multiple dictionaries of params passed in.
Right now, I'm doing thi... |
PySide: Emiting signal from QThread in new syntax
Question: I'm trying (and researching) with little success to emit a signal from a
working Qthread to the main window. I don't seem to understand how I should go
about this in the new syntax.
Here's a simple example.
from PySide.QtCore import *
from ... |
How to get the cwd in a shell-dependend format?
Question: Since I'm using both Windows' `cmd.exe` and
[msysgit](/questions/tagged/msysgit "show questions tagged 'msysgit'")'s
`bash`, trying to access the Windows-path output by `os.getcwd()` is causing
Python to attempt accessing a path starting with a drive letter and ... |
Python: Append column to CSV from a different csv file
Question: I currently have a script which I want to use to combine csv data files. For
example I have a file called process.csv and file.csv but when I try to append
one to the other in a new file called 'all_files.csv' it appends it the
correct column but not from... |
Django 1.8 How do I add `sensitive_variables` or `sensitive_post_parameters` to a FormView method?
Question: When debugging an error with a form submit in Django, I noticed that the
user's password is in plain view in the debug "Request information" readout as
part of the POST parameters.
How do I wrap the `form_valid... |
Python console output to variable
Question: I have seen a few posts on this site and some others that cover a similar
topic don't quite seem to reach the result i am looking for with python v3. My
aim is to have a popup window containing two entry boxes for a username and a
password which i can then output as variables... |
Fastest way to compute distance beetween each points in python
Question: In my project I need to compute euclidian distance beetween each points stored
in an array. The entry array is a 2D numpy array with 3 columns which are the
coordinates(x,y,z) and each rows define a new point.
I'm usualy working with 5000 - 6000 ... |
Parse and combine date and time (leap seconds) from strings - python
Question: I parse a date (format: YYYY-MM-DD HH:MM:SS) from a data file which contains
multiple lines of dates.
The problem is that the data contains **leap seconds** so i'm not able to use
_datetime_. How can I take into account the leap seconds (0-... |
Python using Google App Engine. Upload file feature that stores files in the GAE datastore
Question: I found code for a guestbook storing text in a datastore. I've been looking
all morning to find how would i modify my code to upload a file instead of
reading from the textfield. and displaying the file details after di... |
Python 3 - webbrowser module - open() function
Question: i write a piece of code in python, im a beginner and im learning modules.
import webbrowser as ac
ac.open("istihza.com")
it works correctly but when i run that, site is opening in internet explorer.
i want to make it opened with google ch... |
If and else statement in Google Places API script in Python
Question: I am attempting to write a script that will loop through list items and query
the google places api.
The problem is that some of the queries will return no results, while other
queries will.
The query results are gathered into lists. For every quer... |
Python3: zip in range
Question: I'm new to Python and I'm trying to zip 2 lists together into 1, which I was
already able to do. I've got 2 lists with several things in them, but I'm
asking the user to input a number, which should determine the range. So i've
got List1: A1, A2, A3, A4, A5, A6 and List2: B1,B2,B3,B4,B5,... |
How to Freeze a pane while re-sizing a window that has frames in python using tkinter and pack?
Question: This is my first post on stackoverflow. I am finally posting because I can not
find this anywhere and have been searching for nearly 4 hours, but I am stuck.
Here is my code example:
import tkinter ... |
convert object to json string after function that needs python dict
Question: I have a python function/method that takes in a student and will show
profile... i realized i need to return context as a json string. how do i do
that?
context["student"] = db.query_dict(student_profile_sql.format(student_id=s... |
Extract list from a string
Question: I am extracting data from the Google Adwords Reporting API via `Python`. I can
successfully pull the data and then hold it in a variable data.
data = get_report_data_from_google()
type(data)
str
Here is a sample:
data = 'ID,Labels,Dat... |
Python convert date string to timestamp
Question: I need to convert string type _Wed, 18 May 2016 11:21:35 GMT_ to timestamp, in
Python. I'm using:
datetime.datetime.strptime(string, format)
But I don't want to specify the format for the date type.
Answer: > But I don't want to specify the format... |
From Python to Mathematica and back again
Question: I wrote a Python script, which produces an output that goes to a file. This is
read as an input file by Mathematica, that then uses it to make some
operations and finally returns another output file. In turn, this last file
should be read by the same initial Python sc... |
Import Errors with Python script run in R
Question: I have a Python program, which searches for an anomaly (First train, then
test). Now I need to start this Python program from RStudio. I have read about
`system('python myfirstpythonfile.py')`, but when I launch my Python program
in this way I have import errors with ... |
How to make an embedded python interpreter's local space share some variables with global space
Question: I have written a command line widget in my pyside program. The structure is
like this:
class CommandWidget(QWidget):
def __init__(self, parent = None):
super(CommandWidget, self).__in... |
Retrieve created_at timestamp from pgsql
Question: I'm a Python newbie. I wrote an sql query to retrieve created_at timestamp in
pgsql. When I called the method `strftime('%x')` on it, I got this error:
AttributeError: 'long' object has no attribute 'strftime'
This is the query:
SELE... |
Cutting out a portion of video - python
Question: I have videos of length approximately 25 min each and I wish to cut a few
seconds from the start using python.
Searching about it, I stumbled upon the moviepy package for python. The
problem is, it takes up a lot of time even for a single video. Following is
the code s... |
how to justify text in label in tkinter in python Need justify in tkinter
Question: In Tkinter in Python: I have a table with a different label. How can I justify
the text that is in the label? Because It is a table and the texts in
different labels come together!
from tkinter import *
root=Tk()
... |
Multiple Postgres SELECT processes(django GET requests) stuck, causing 100% CPU usage
Question: I'll try to give as much information I can here. Although the solution would
be great, I just want guidance on how to tackle the problem. How to view more
useful log files, etc. As I'm new to server maintainance. Any advice ... |
Creating batches from custom dataset of images in Tensorflow
Question: I'm reading a list of .jpg images from disk, and I wanted to split it in
several batches. But I got a ValueError while trying to create the first
batch.
Here is my code:
import tensorflow as tf
import os
images_list = []... |
How to get handle of a known data table
Question: I am hoping to figure out the answer of a seemingly simple question. Below I
was trying to get the handle of a known table, by the name of "TableMe". Being
able to print its name back on the screen would prove that I have got the
handle correctly.
from Sp... |
mod_wsgi apache with python-eve
Question: I tried to integrate my `eve` app into `apache`. I think I did all correctly
like it is shown in flask documentation.
When I try to consume my `eve` collection...I get an error in apache log:
Traceback (most recent call last):
File "/var/customers/webs/myapp... |
PyXB module not recognised
Question: I have installed pyxb module regular way (python setup.py install) and here is
the output:
Found bundle in pyxb/bundles/common
Found bundle in pyxb/bundles/dc
Found bundle in pyxb/bundles/wssplat
Found bundle in pyxb/bundles/saml20
running install
... |
How can I iterate through different CSV files with Python/Pandas by first column and item value?
Question: I have a folder which has over 100 CSV files each have more than 40k rows. I
am trying to iterate through these files by first column, which has the ID
numbers. My purpose is to find the rows that have the same ID... |
SWIG c++ vector access in python
Question: This may be a noob question but here it goes. I have wrapped a 3d vector into
a python module using SWIG. Everything has compiled and I can import the
module and perform actions with it. I can't seem to figure out how to access
my vector in python to store and change values in... |
How to avoid SQL injection with "SELECT * FROM {table_name}"?
Question: In Python using Psycopg2 with the following code:
import psycopg2
import getpass
conn = psycopg2.connect("dbname=mydb user=%s" % getpass.getuser())
cursor = conn.cursor()
tables = ["user", "group", "par... |
For Loop Not iterating correctly With Functions Called
Question: I have been having some problems getting this for loop to iterate, call
functions, and then return to the loop and iterate again. It only runs twice
as of right now. I figure it has a way to do with how I am calling functions
inside of the loop. Is there ... |
Python: Intersection of Two 2D Arrays
Question: I have data in `.csv` file called 'Max.csv':
Valid Date MAX
1/1/1995 51
1/2/1995 45
1/3/1995 48
1/4/1995 45
Another csv called 'Min.csv' looks like:
Valid Date MIN
1/2/1995 33
1/4/1995 31
... |
Find Maximum and minimum value in a matrix, Python
Question: How can I find the lowest value given the number of the exercise?, I have this
code:
mat = []
calificaciones = []
#Captures student ID
def lmat (numeroest):
mattotal = []
for i in range (0, numeroest):
ma... |
Python Graphing Attribute Error
Question: I edited the code with the suggestions and currently receive this error
Traceback (most recent call last): File
"C:\Users\Jonathan.HollowayMainPc\Documents\Inchimoku Kinko Hyo.py", line 111,
in ichimoku_chart() File "C:\Users\Jonathan.HollowayMainPc\Documents\Inchimoku
Kinko Hy... |
Memory usage when reading lines from a piped subprocess stdout in python
Question: I just want to understand what happens in the "background" in terms of memory
usage when dealing with a subprocess.Popen() result and reading line by line.
Here's a simple example.
Given the following script `test.py` that prints "Hello... |
How to create file exception for multiple file analysis in Python
Question: I am analysing a large set of weather data (about 13000 files) and writing the
results to a file. Is there a way of implementing the code I have below in
such a way that it will ignore problematic files, that is, if a particular
file produces a... |
Python: How to get internal directory structure of Outlook PST file?
Question: Is there any Library for Python (Windows) to read the Internal Directory
structure of PST file eg. Inbox, Drafts, etc including Folders created by
Users.
Answer: as per <https://support.microsoft.com/en-us/kb/287070>
> Microsoft Outlook a... |
TypeError: object() takes no parameters - attempting to load a .txt file into a game
Question: I've been trying to work through [How to Write a Text Adventure in
Python](http://letstalkdata.com/2014/08/how-to-write-a-text-adventure-in-
python-part-2-the-world-space/) but have run into the error `TypeError:
object() tak... |
Spider won't run after updating Scrapy
Question: As seems to frequently happen here, I am quite new to Python 2.7 and Scrapy.
Our project has us scraping website date, following some links and more
scraping, and so on. This was all working fine. Then I updated Scrapy.
Now when I launch my spider, I get the following m... |
wxpython table label background color overflowing the grid
Question: I have to make a wxpython table using grid.I have set the background color of
the table using grid.SetLabelBackgroundColour("green"). But it is overflowing
the grid and changing color of the area outside the header also. Can anybody
please help me in ... |
How to transfer data on SQL Table to Excel file in Python?
Question: So I have a working piece of code which creates and modifies data in a SQL
table. I now want to transfer all the data in the SQL table to a Excel file.
Which libraries would I use and what functions in those libraries would I use?
Answer: an example... |
Getting file path from command line arguments in python
Question: I would like to read a file path from command line arguments, using argparse.
Is there any optimal way to check if the path is relative (file is in current
directory) or the complete path is given? (Other than checking the input and
adding current direct... |
Want to convert sqlite code in Shared preference code
Question: I made a quiz application using sqlite data base but now have to convert this
in shared preference. How can I change it to shared preference??
Here is my code
QuizActivity.java
import java.util.List;
import android.os.Bundle;
impor... |
How to prevent inserting a record different from the model in python
Question: I have a data model that have some primitive and array type properties as
shown below:
class WordCollection:
"""First model"""
def __init__(self, **properties):
self.name = ""
self.statu... |
cURL request to Python (using multipart/form-data)
Question: I am trying to translate this cURL request:
curl -X POST "endpoint" -H 'Content-Type: multipart/form-data' -F "config=@conf.ttl"
So far I've got this:
requests.post(
endpoint,
headers={"Content-Type": "mul... |
Python Regex - Match and Start()
Question: Let's say I need to find the word "water" in a string. This word cannot be
part of another word and it can't be preceded by punctuation (so i'm assuming
it can only be preceded by a " " or it's the beginning of the string). I need
to return the index of the word's first char "... |
pytest exits with no error but with "collected 0 items"
Question: I have been trying to run unit tests using pytest in python. I had written a
module with one class and some methods inside that class. I wrote a unit test
for this module (with a simple assert statement to check equality of lists)
where I first instantia... |
List Index Is Out of Range And I Don't Know Why
Question: So this is the error:
Traceback (most recent call last):
File "E:\python\cloud.py", line 593, in <module>
inventory()
File "E:\python\cloud.py", line 297, in inventory
print("Weapon Attack Damage: ", c.weaponAttack[i])
... |
An elegant, readable way to read Butcher tableau from a file
Question: I'm trying to read a specifically formatted file (namely, the Butcher tableau)
in python 3.5. The file looks like this(tab separated):
S
a1 b11 b12 ... b1S
a2 b21 b22 ... b2S
...
aS bS1 bS2 ... bSS
0.0 c1 ... |
How to improve Python iteration performance over large files
Question: I have a reference file that is about 9,000 lines and has the following
structure: (index, size) - where index is unique but size may not be.
0 193532
1 10508
2 13984
3 14296
4 12572
5 12652
6 13688
7 14256... |
Removing brackets from Scrapy json output
Question: Final part of my code is to load data from my scrapy pipeline to my pandas
dataframe.
A sample result is as below:
{"Message": ["\r\n", " Profanity directed toward staff. ", "\r\n Profanity directed toward warden ", " \r\n "], "Desc": "https://www.t... |
Python calculation error
Question: I am trying to implement an LCM finding algorithm. It needs to find LCM for
very large numbers.
LCM is found using the formula,
LCM(A, B) = (A * B) / GCD(A, B)
where A and B are two inputs.
Input: `226553150 1023473145`
So, `LCM = (226553150 * 1023473145) / 5`... |
Python matplotlib animating the path of an object
Question: I've been fiddling with [this](https://github.com/dm6718/Massive-Spring-
Pendulum/blob/master/Massive%20Spring%20Pendulum.py#L68) bit of Python code to
simualate a spring-pendulum system. I altered the equation slightly and it
plots fine. However, I also want ... |
List Index Out of Range, Why Is This Happening?
Question: Here's the error I'm getting:
Traceback (most recent call last):
File "E:\python\cloud.py", line 34, in <module>
c = Cloud()
File "E:\python\cloud.py", line 18, in __init__
self.cweaponAttack = self.weaponAttack[0]
... |
I installed multiple Ipython kernels, but after this I cannot import numpy, pandas
Question: I wanted to be able to use both python 2.x and 3.x so I installed multiple
kernels as follows, as per the instructions in this question ([Using both
Python 2.x and Python 3.x in IPython
Notebook](http://stackoverflow.com/questi... |
Sorting JSON by attribute's value using Python
Question: I have the following JSON file
{
"modifyDate": 1463899037000,
"champions": [
{
"id": 40,
"stats": {
"totalDeathsPerSession": 60,
"totalSessionsPlayed": 18,
... |
"One off" error in numpy.r_ array construction
Question: Suppose I want to construct an array in Python/numpy using the r_ operator
like so.
>>> import numpy as np
>>> np.r_[0.02:0.04:0.01]
array([ 0.02, 0.03])
>>> np.r_[0.04:0.06:0.01]
array([ 0.04, 0.05])
Both cases work as expe... |
Call function from a file B in a loop in file A
Question: I have a python file B with all my function and a main code which is in loop
of 0.25 sec, and I want to call this file in a loop in my file A. Can you get
my weird mind ? What I did but only read the loop from file B once :
#FileA
while 1:
... |
How can I Draw rectangle in programmatically
Question: How can I draw rectangle(Oblique projection view) in programmatically(python)
by giving height, width and depth.
Answer: Take a look at Python's `turtle` module, [here is the v3.3
documentation](https://docs.python.org/3.3/library/turtle.html). On top of
height, ... |
numpy.ndarray object not callable in brute
Question: I am following the code in a "Python for Finance" book and trying to optimize
a function but am getting an error when following the code.
> TypeError: 'numpy.ndarray' object is not callable
The other forums on this error don't seem to be applicable.
Please let me ... |
How to use install Theano on Python 2.7.9 on windows 8.1 Pro ?
Question: Also, it would be great if someone can help me with installation of "nolearn"
package too. Thanks!
Answer: I think the issue is that you don't have the import library for libpython.
This is lack for linking with msvc on Windows and does not ordi... |
Python regex to extract phone numbers from string
Question: I am very new to regex , Using python re i am looking to extract phone numbers
from the following multi-line string text below :
Source = """<p><strong>Kuala Lumpur</strong><strong>:</strong> +60 (0)3 2723 7900</p>
<p><strong>Mutiar... |
When reading in a txt matrix, how can i skip first column
Question: I have a file that looks like this:
1 2 3 4 5 6 7
1 0 1 1 1 1 1 1
2 0 0 1 1 1 1 1
3 0 0 0 1 1 1 1
4 0 0 0 0 1 1 1
5 0 0 0 0 0 1 1
... |
ValueError: invalid literal for long() with base 10: '5B'
Question: What I understood of this error is that it means that there is a column that
is of type long(). But this column contains a value named '5B' which isn't a
long type.
This is the line where the error occurs:
df_Company = df1.groupby(by=['... |
Pretty formatting of long string
Question: The string
date2check = to_datetime(str(last_tx.year) + \
'-' + str(int(last_tx.month)-3) + \
'-' + str(last_tx.day) + \
' ' + str(last_tx.hour) + \
'... |
Error using python logging from Pydev
Question: I am using PyDev with Python 3.5 from Aptana installation. All worked fine
until I decided to explore logging module, which I never used before. I
started with new script from the tutorial:
import logging
logging.warning('Watch out!') # will print a me... |
how to take a line from a text to use as input for a function python
Question: Hi guys I have a text fill with some geodata that looks like this:
[(-76.34666,40.006886),(-76.34666,40.073017),(-76.25411,40.073017),(76.25411,40.006886)]
[(-84.82031,38.403187)),(-84.82031,42.327133),(-80.51862,42.327133),(-80.51862,38.40... |
"TypeError: list indices must be integers, not str" in Python 2.7
Question: I'm currently taking a Data Analysis course on Udacity. I'm having a bit of
hard time. I have I'm currently trying to convert some data types in some
dictionaries and I keep getting the error "TypeError: list indices must be
integers, not str" ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.