python-2.7 Questions
3
Solved
pandas.DataFrame.to_dict converts nan to nan and null to None. As explained in Python comparison ignoring nan this is sometimes suboptimal.
Is there a way to convert all nans to None? (either in p...
Aeriel asked 25/1, 2018 at 22:50
8
Solved
def sendEmail(to,apNumber,paperType,zipedFile):
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get("API-KEY"))
to_email = mail.Email( "[email protected]")
from_email = mail.Email( "[em...
Nescience asked 27/9, 2016 at 6:56
6
Solved
I have a string in Python like this:
u'\u200cHealth & Fitness'
How can i remove the
\u200c
part from the string ?
Doityourself asked 11/9, 2017 at 11:24
6
What is the best way to remove all characters from a string that are not in the alphabet? I mean, remove all spaces, interpunction, brackets, numbers, mathematical operators..
For example:
input...
Sashasashay asked 11/12, 2015 at 0:16
7
Solved
I'm learning Python by following Automate the Boring Stuff. This program is supposed to go to http://xkcd.com/ and download all the images for offline viewing.
I'm on version 2.7 and Mac.
For s...
Corr asked 11/6, 2015 at 1:44
21
I have a flask project I am trying to debug (this was working absolutely ok till few hours ago) - When I debug the project, I see the following :
Connected to pydev debugger (build 135.1057)
/User...
Lachus asked 10/12, 2014 at 12:7
5
I'm trying to build a calculator that does basic operations of complex numbers. I'm using code for a calculator I found online and I want to be able to take user input as a complex number. Right no...
Ostracod asked 9/9, 2016 at 14:7
5
I am developing an automated attendance system where when a student scans his RFID tag, his attendance is recorded while showing a welcoming message using a tkmessagebox pop-up. The user will not h...
Selfconsequence asked 14/5, 2015 at 10:57
3
Duplicate of this issue, but the first answer there is wrong (jq is supported on Windows) and the second refers to brew so I'm guessing is for Mac.
Windows
I am trying to install jq for python fr...
Kalmia asked 16/2, 2017 at 0:59
6
Solved
I'm trying to write a script that opens a new terminal then runs a separate python script from that terminal.
I've tried:
os.system("gnome-terminal 'python f.py'")
and
p = Popen("/usr/bin/gno...
Hexone asked 27/11, 2017 at 20:4
2
Solved
I understand that pandas dataframe type has an ability to test the logic of it's value.
here's the code:
import pandas as pd
data = pd.DataFrame(columns=['a', 'b', 'c'])
data = data.append({'a': ...
Interviewee asked 11/1, 2014 at 3:37
21
Solved
I'm using pylint in Visual Studio Code to develop a Google App Engine (GAE) Cloud Endpoint API in Python. I'm unable to resolve a lint error. I don't know what's causing the error, but at a guess, ...
Chrysostom asked 23/4, 2017 at 18:38
10
Solved
I wrote a script to call an API and ran it successfully last week. This week, it won't run. I get back the following error message:
Traceback (most recent call last):
File "user_audit.py", line 2...
Lila asked 7/3, 2017 at 14:42
4
I'm using python 2.7.6 and in my code I have a line:
import psycopg2.extensions
which I've installed using pip. Next, my editor tells me, that psycopg2 requires python_ldap=2.4.19.
However, in ...
Allisonallissa asked 29/11, 2016 at 17:2
7
I have a pandas data frame my_df, and my_df.dtypes gives us:
ts int64
fieldA object
fieldB object
fieldC object
fieldD object
fieldE object
dtype: object
Then I am trying to convert the pandas d...
Bevon asked 9/11, 2016 at 23:11
6
Solved
I have urls formatted as:
google.com
www.google.com
http://google.com
http://www.google.com
I would like to convert all type of links to a uniform format, starting with http://
http://google.co...
Lapierre asked 9/2, 2014 at 12:30
5
Solved
In Kivy language, it is possible to refer to the root widget with something like
<RootWidget>:
BoxLayout:
SomeButton:
on_press: print root
but trying to access root from Python is impo...
Olinger asked 23/8, 2015 at 0:53
3
I'm using subprocess.Popen with Python, and I haven't come across an elegant solution for joining commands (i.e. foobar&& bizbang) via Popen.
I could do this:
p1 = subprocess.Popen(["m...
Midtown asked 17/3, 2013 at 22:51
3
Solved
how do you overwrite the previous print in python 2.7?
I am making a simple program to calculate pi. here is the code:
o = 0
hpi = 1.0
i = 1
print "pi calculator"
acc= int(raw_input("enter accurac...
Hypoploid asked 25/3, 2012 at 13:55
15
Getting this error:
sudo: unable to resolve host coderw@ll
-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHand...
Dalenedalenna asked 11/6, 2014 at 23:48
6
So, I am trying to create a Spark session in Python 2.7 using the following:
#Initialize SparkSession and SparkContext
from pyspark.sql import SparkSession
from pyspark import SparkContext
#Crea...
Galcha asked 9/5, 2017 at 7:20
3
Using ReportLab 2.7, Python 2.7:
I can create a pdf with clickable bookmarks in the table of contents (toc), or I can create a pdf with "x of y" page numbering, but the bookmarkpage(key) appears t...
Trichiasis asked 16/4, 2013 at 15:45
9
This is my python hello.py script:
def hello(a,b):
print "hello and that's your sum:"
sum=a+b
print sum
import sys
if __name__ == "__main__":
hello(sys.argv[2])
The problem is that it can'...
Sent asked 9/7, 2013 at 9:11
3
Solved
I'm using Python 3.4, I'm trying to use argparse with subparsers, and I want to have a similar behavior to the one in Python 2.x where if I don't supply a positional argument (to indicate the subpa...
Clouded asked 28/4, 2014 at 19:12
10
Solved
I have developed a python script where i have a setting window which has the options to select the paths for the installation of software.When clicked on OK button of the setting window, i want to ...
Wendeline asked 28/2, 2013 at 5:34
© 2022 - 2024 — McMap. All rights reserved.