text
stringlengths
226
34.5k
Python: deleting string from first numeric character Question: How could I delete/split the string below from the first numeric character? > Good 11 hdle would become > Good the only things I can seem to find are removing numbers OR letters from the whole string Answer: import re str = "some text 12345 o...
Quandl is not being imported Question: I'm getting started for Machine learning using Python and would like to use Quandl for computing. I installed the Quandl using `pip install Quandl` and also, pandas using `pip install pandas`. Later, the `import` for pandas is successful, but, I couldn't import quandl. I get error...
Timing Modular Exponentiation in Python: syntax vs function Question: In Python, if the builtin `pow()` function is used with 3 arguments, the last one is used as the modulus of the exponentiation, resulting in a [Modular exponentiation](https://en.wikipedia.org/wiki/Modular_exponentiation) operation. In other words, ...
Dealing with mis-escaped characters in JSON Question: I am reading a JSON file into Python which contains escaped single quotes (_\'_). This leads to all kinds of hiccups, as nicely discussed e.g. [here](http://stackoverflow.com/questions/2275359/jquery-single-quote-in-json- response). However, I could not find anythin...
can't download and install python image library Question: I'm trying to download and install pythons image library PIL or pillow. I've looked at this question ([No module named Image](http://stackoverflow.com/questions/12024397/no-module-named-image)) and this question ([Can't install Python Imaging Library using pip](...
Add a list to a numpy array Question: Right now I'm writing a function that reads data from a file, with the goal being to add that data to a numpy array and return said array. I would like to return the array as a 2D array, however I'm not sure what the complete shape of the array will be (I know the amount of column...
How to upload a file to a server? Question: I want to upload files to my servers at Digital Ocean and AWS. I can do that via the terminal using scp or sftp, but I want to automate this and do it in Python or any other programming language. In case of Python, how can I upload a file to a server in high level, should I u...
Running python program on linux Question: I'm not very familiar with linux as well as python. I'm taking this class that have example code of a inverted index program on python. I would like to know how to run and test the code. Here's the code that was provided to me. This is the code for the mapping file. (inverted_...
Python: How to prevent python dictionary from putting quotes around my json? Question: I am using requests to create a post request on a contractor's API. I have a JSON variable `inputJSON` that undergoes formatting like so: def dolayoutCalc(inputJSON): inputJSON = ast.literal_eval(inputJSON) ...
How to get offset position of a text in html page in python Question: I am doing a webscraping to extract some text using beautiful soup. I am successfully extracting the required text from the webpage but my new requirement is along with the text I need to extract the offset number/position where the text actually st...
Python3 Converting Non-English Chars to English Chars Question: I have a text file, I read file and after some operation I put these lines into another file. But input file has some Turkish chars such as "İ,Ö,Ü,Ş,Ç,Ğ". I want these chars to be converted to English chars because when I open the files in UTF-8 encoding, ...
python numpy strange boolean arithmetic behaviour Question: Why is it, in python/numpy: from numpy import asarray bools=asarray([False,True]) print(bools) [False True] print(1*bools, 0+bools, 0-bools) # False, True are valued as 0, 1 [0 1] [0 1] [ 0 -1] print(-2*...
python3 and RO package and DS9 Question: How to get RO package working in Python 3? I managed to get it to work in Python 2.7, but when I install it manually as `python3 setup.py install` and then do `import RO.DS9` I get this: Traceback (most recent call last): File "<stdin>", line 1, in <module> ...
How to access a List of Objects from outside a class in python Question: Hope you can help me on this one. I have created a list of objects because the program that I use creates lots of agents and it is easier to keep track.I want to access that information from outside the class, so I need to call that list and call ...
Python: Using Pandas, how do I choose the columns in my output? Question: I am running my whole Active directory against user accounts trying to find what doesn't belong. Using my code my output gives me the words that only occur once in the Username column. Even though I am analyzing one column of data, I want to keep...
bug while trying to create a function from other functions in python Question: I have been trying to create a calculator and i had for practical reasons i tried to import functions from a separate python file. It works at some extent but it breaks when it tries to do the calculations. The bug is is that the add is not ...
Can a set() be shared between Python processes? Question: I am using multiprocessing in Python 2.7 to process a very large set of data. As each process runs, it adds integers to a shared mp.Manager.Queue(), but only if some other process hasn't already added the same integer. Since you can't do an "in"-style membership...
How to crawl each and every link given on a website and collect all the text using scrapy Question: I followed link `https://stackoverflow.com/questions/19254630/how-to-use-scrapy-to-crawl-all- items-in-a-website` but things does not work out for me. I am trying to learn scraping data over web.I was implementing tut...
Singleton/Borg pattern based on different parameters passed while creating the object Question: I am using borg pattern to share state amongst the objects: class Borg: __shared_state = {} def __init__(self): self.__dict__ = self.__shared_state Now lets assume that I...
Python relative/absolute import (again) Question: This topic has been covered several times but I still can't get my package to work. Here is the situation: I've got a package in which a `logging` module takes care of setting up the logging. So clearly, `mypackage.logging` conflicts with Python `logging` from the stand...
python ldap3 search LDAPOperationsErrorResult Question: I would like to get all PCs in the local network from ldap, so I tried (variations of) this: import ldap3 from ldap3 import ALL_ATTRIBUTES, SUBTREE, ALL import dns.resolver import socket def get_ldap_server(): domain_nam...
Python limit on input function in terminal Question: I am currently using the input function to capture user inputs in the terminal and copy them to the clipboard where it is then used by another application. Wierdly it appears that there is a limit to the number of characters that you can enter when using input in th...
Why is subprocess.run output different from shell output of same command? Question: I am using `subprocess.run()` for some automated testing. Mostly to automate doing: dummy.exe < file.txt > foo.txt diff file.txt foo.txt If you execute the above redirection in a shell, the two files are always ...
Reading with xlrd in python Question: I wrote this program to read a column from an excel file then write it into a txt file: import xlrd, sys text_file = open("Output.txt", "w") isotope = xlrd.open_workbook(sys.argv[1]) first_sheet=isotope.sheet_by_index(0) x= [] for rownum in r...
Pandas GroupBy Two Text Columns And Return The Max Rows Based On Counts Question: I'm trying to figure out the max `(First_Word, Group)` pairs import pandas as pd df = pd.DataFrame({'First_Word': ['apple', 'apple', 'orange', 'apple', 'pear'], 'Group': ['apple bins', 'apple trees',...
virtualenv isolated app somehow finds global django installation instead of local one Question: 1. I have globally installed django v1.8 on (ubuntu + apache + mod_wsgi) 2. I have a virtualenv _'myenv'_ with --no-site-packages (which means it is isolated from global packages) with django 1.9 installed inside here i...
Send file contents over ftp python Question: I have this Python Script import os import random import ftplib from tkinter import Tk # now, we will grab all Windows clipboard data, and put to var clipboard = Tk().clipboard_get() # print(clipboard) # this fea...
Bytecode optimization Question: Here are 2 simple examples. In the first example `append` method produces LOAD_ATTR instruction inside the cycle, in the second it only produced once and result saved in variable (ie cached). _Reminder: I remember, that there`extend` method for this task which is much faster that this_ ...
python nosetests AssertionError: None != 'hmmm...' Question: below is the test I am trying to run: def test_hmm_method_returns_hmm(self): #set_trace() assert_equals( orphan_elb_finder.hmm(), 'hmmm...') When I run the code I get the following output: D:\dev\git_rep...
Python import old version package instead of new one Question: I install the library 'numpy1.11.0', 'pandas0.18.1', 'scipy0.17.1' with pip into the site-packages. The problem is that when I import numpy and scipy in my project, an old version which has also been installed is imported instead of the new version: ...
Selecting values from a JSON file in Python Question: I am getting JIRA data using the following python code, how do I store the response for more than one key (my example shows only one KEY but in general I get lot of data) and print **only** the values corresponding to `total,key, customfield_12830, summary` ...
How to apply a python file execution over selected file in OSX Terminal? Question: I am asked to create a python file abc.py, and then execute that python command over filename.txt The code in terminal (OSX): $ python abc.py filename.txt How do I write the code in the abc.py file such that it ...
Python3 convert Julian date to standard date Question: I have a string as Julian date like `"16152"` meaning 152'nd day of 2016 or `"15234"` meaning 234'th day of 2015. How can I convert these Julian dates to format like `20/05/2016` using Python 3 standard library? I can get the year 2016 like this: `date = 20 + jul...
Different models with gensim Word2Vec on python Question: I am trying to apply the word2vec model implemented in the library gensim in python. I have a list of sentences (each sentences is a list of words). For instance let us have: sentences=[['first','second','third','fourth']]*n and I implement...
Golang: How can I write a map which is mixed with string and array? Question: I am a beginner of `Go`. I wrote this code, but an error occurred. How should I write a map which contains `string` and `[]string` properties? package main import ( "fmt" ) func main() { pr...
update tkinter label with mouse click Question: I am the beginner in Python and am trying to code a tictactoe game with `tkinter`. My class named `Cell` extends `Tkinter.Label`. The `Cell` class contains data fields `emptyLabel`, `xLabel` and `oLabel`. This is my code so far for class `Cell`: from tkinte...
Kivy - Touch not answer everytime on android Question: I have an App which is working fine, but sometimes I don't have touch answer, no matter where (Button, Tabbed Panel...). This happens in other android I tested, different versions and different cell phones. Sometimes I touch once and answer is ok, sometimes I need ...
How to disregard the NaN data point in numpy array and generate the normalized data in Python? Question: Say I have a numpy array that has some float('nan'), I don't want to impute those data now and I want to first normalize those and keep the NaN data at the original space, is there any way I can do that? Previously...
Load a cache file in Maya using Python and create the same render output Question: I try to load a cache file in Maya using a python script. I used the code snipped posted here: [importing multiple cache files in Maya using Python](http://stackoverflow.com/questions/20174424/importing-multiple-cache- files-in-maya-usin...
Restart ipython Kernel with a command from a cell Question: Is it possible to restart an `ipython` Kernel NOT by selecting `Kernel` > `Restart` from the notebook GUI, but from executing a command in a notebook cell? Answer: As Thomas K. suggested, here is the way to restart the `ipython` kernel from your keyboard: ...
Tkinter GUI Freezes - Tips to Unblock/Thread? Question: New to python3 and started my first project of using a raspberry pi 3 to create an interface to monitor and control elements in my greenhouse. Currently the program reads Temperature and Humidity via a DHT11 sensor, and controls a number of relays and servo via th...
How do I extract only the file of a .tar.gz member? Question: My goal is to unpack a `.tar.gz` file and not its sub-directories leading up to the file. My code is based off this [question](http://stackoverflow.com/questions/4917284/extract-files-from-zip- without-keeping-the-structure-using-python-zipfile) except inst...
Python for Android : apk stuck on loading screen Question: I am trying to convert my python 3 code into an apk using Python-For-Android's tool. They have recently added python 3 support albeit it being experimental. It may be of importance to note that my whole program is written in pure python and uses no kivy framew...
How to take a word from a dictionary by its definition Question: I am creating a code where I need to take a string of words, convert it into numbers where `hi bye hi hello` would turn into `0 1 0 2`. I have used dictionary's to do this and this is why I am having trouble on the next part. I then need to compress this ...
How to use SyntaxNet output to operate an executive command ,for example save a file in a folder, on Linux system Question: having downloaded and trained [SyntaxNet](https://github.com/tensorflow/models/tree/master/syntaxnet), I am trying to write a program that can open new/existed files, for example AutoCAD files, an...
Python lxml getpath error Question: I'm trying to get a full list of xpaths from a device config in xml. When I run it though I get: AttributeError: 'Element' object has no attribute 'getpath' Code is just a few lines import xml.etree.ElementTree import os from lxml import ...
Python, using tkinter how to customize where classes of ui components are displayed? Question: I am very new to python, and am currently trying to organize my tkinter app in a slightly different way. I'm trying to use classes to make the app more modular and be able to use methods in the class in multiple places in the...
unbound method must be called with instance as first argument Question: I am trying to build simple fraction calculator in python2.x from fractions import Fraction class Thefraction: def __init__(self,a,b): self.a = a self.b =b def add(self): r...
Python: Return all Indices of every occurrence of a Sub List within a Main List Question: I have a Main List and a Sub List and I want to locate the indices of every occurrence of the Sub List that are found in the Main List, in this example, I want the following list of indices returned. >>> main_list =...
MongoDB query filters using Stratio's Spark-MongoDB library Question: I'm trying to query a MongoDB collection using Stratio's Spark-MongoDB [library](https://github.com/Stratio/Spark-MongoDB). I followed [this](http://stackoverflow.com/questions/33391840/getting-spark-python-and- mongodb-to-work-together) thread to ge...
Cannot pickle Scikit learn NearestNeighbor classifier - can't pickle instancemethod objects Question: I'm trying to pickle NearestNeighbor model but it says can't pickle instancemethod objects. The code: import cPickle as pickle from sklearn.neighbors import NearestNeighbors nbrs = NearestN...
Python OpenCV face detection code sometimes raises `'tuple' object has no attribute 'shape'` Question: I am trying to build a face detection application in python using opencv. Please see below for my code snippets: # Loading the Haar Cascade Classifier cascadePath = "/home/work/haarcascade_fronta...
Django website on Apache with wsgi failing Question: so i'm about to lunch my first django website , i currently have a server that has been configured to host php websites and i've decided to test a simple empty project to get familiar with the process so the python version in this server is bit old (2.6) so i couldn...
How to properly do importing during development of a python package? Question: I am a first year computer science student currently working on a small project that I save to dropbox for school. I apologize in advance for a potentially trivial question. But having little to no experience and after trying all the debugg...
Tensorflow error: InvalidArgumentError: Different number of component types. Question: I want to input batches of shuffled images to be training, and I write the code according to [the generic input images in TensorVision](https://github.com/TensorVision/TensorVision/blob/master/examples/inputs/generic_input.py), but I...
Assigning 2d array in vector of indices Question: Given 2d array `k = np.zeros((M, N))` and list of indices in the range `0, 1 .., M-1` of size `N` called `places = np.random.random_integers(0, M-1, N)` how do I assign 1 in each column of `k` in the `places[i]` index where i is running index. I would like to achieve th...
Why isn't kv binding of the screen change working? Question: I've defined two buttons: one in kv and one in Python. They are located in different screens and are used to navigate between them. What I found strange is that the button that was defined in Python successfully switched the screen, while the one defined in k...
Which number is bigger and by how much for random numbers Question: I'm doing an online tutorial on python, and its asking to write a program that takes two random integers as parameters and display which integar is larger and by how much using a void function. But if both random intgars are the same the def show-large...
Push button GPIO.FALLING event getting triggered twice Question: This is my first attempt at coding a Raspberry Pi and a hardware push button on a breadboard. The program is simple, when a button press is detected, turn on an LED on the breadboard for 1 second. My code seems to work, but strangely every so often one bu...
are elements of an array in a set? Question: import numpy data = numpy.random.randint(0, 10, (6,8)) test = set(numpy.random.randint(0, 10, 5)) I want an expression whose value is a Boolean array, with the same shape of `data` (or, at least, can be reshaped to the same shape), that tells me if the cor...
string (file1.txt) search from file2.txt Question: `file1.txt` contains usernames, i.e. tony peter john ... `file2.txt` contains user details, just one line for each user details, i.e. alice 20160102 1101 abc john 20120212 1110 zjc9 mary 20140405 0100 fe...
Python: Encode ordered categories/factors to numeric w/ specific encoding conversion Question: TLDR: What's the most concise way to encode ordered categories to numeric w/ a particular encoding conversion? (i.e. one that preserves the ordered nature of the categories). ["Weak","Normal","Strong"] --> [0,1,2] * * * As...
How do I print the output of the exec() function in python 3.5? Question: How do I have it so that you pass in a python command to the exec() command, waits for completion, and print out the output of everything that just happened? Many of the code out there uses StringIO, something that is not included in Python 3.5....
Python shell is restarted every time I do “run module” inside editor? Question: I am using python 2 on Ubuntu and when writing `import webbrowser webbrowser.open("fb.com")` and run the module, the shell restarts and nothing happens. What is the problem here? Answer: It's hard to say without any code presented, but mo...
How to display graph and Video file in a single frame/Window in python? Question: [I want something similar like this image and this is same layout which I supposed to want.](http://i.stack.imgur.com/m4FXc.jpg) And with additional note,I want to generate a graph based on the video file timings.For Eg. 10 sec this grap...
Python and CSV; how to truncate all values in a column? Question: Given a simple CSV file like this: Django,Gunslinger,101-707 KingSchultz,Dentist,205-707 Tatum,Marshall,615-707 Broomhilda,Wife,910-707 ...,...,... How do you truncate all the values in the last column so that only th...
How to Reduce Running (for loop), Python Question: 1. Following Code is taking too much running time (more than 5min) 2. Is there any good ways to reduce running time. data.head() # more than 10 year data, Total iteration is around 4,500,000 Open High Low Close Volu...
pass json file as command line argument through parser , is this possible? Question: I need to overwrite json file parameters to a python dictionary through command line argument parser. Since, json file is located in the current working directory but its name can be dynamic , so i want something like below :- > pytho...
using string.strip() in python to extract specific coloumns Question: import requests from bs4 import BeautifulSoup f = open('path to create /Price.csv','w') errorFile = open('path to create /errorPrice.txt','w') year = 2012; month = 1; day =1 if year<= 2016: if day > 32: mo...
dnspython not updated when changing resolv.conf Question: This snippet works perfect import dns import dns.resolver default = dns.resolver.get_default_resolver() nameserver = default.nameservers[0] except that if I change /etc/resolv.conf by hand and call again get_default_resolver...
Trouble importing shared object in Python Question: I am attempting to import a shared object into my python code, like so: import bz2 to which I get the following error: > ImportError: ./bz2.so: cannot open shared object file: No such file or > directory Using the imp module, I can verify that P...
How do I implement this similarity measure in Python? Question: I tried implementing the distance measure shown in the image, in Python as such: import numpy as np A = [1, 2, 3, 4, 5, 6, 7, 8, 1] B = [1, 2, 3, 2, 4, 6, 7, 8, 2] A = np.asarray(A).flatten() B = np.asarray(B).flatt...
Python 3 - Limiting Memory Usage from a Script Question: I am using the itertools module to create a list of possible permutations for the order of letters in a rather long sentence. However, every time I do so I run out of memory (I have 16GB RAM before anyone asks). I don't have the code on this machine, however it ...
Python Matplotlib histogram bin shift Question: I have created a cumulative (CDF) histogram from a list which is what I wanted. Then I subtracted a fixed value (by using `x = [ fixed_value - i for i in myArray]`) from each element in the list to essential just shift the bins over a fixed amount. This however makes my C...
cx_Oracle: DLL load failed Question: I'm trying to `import cx_Oracle` in Python and getting an: ImportError: DLL load failed: The specified procedure could not be found. [This post](http://stackoverflow.com/questions/24124110/cx-oracle-dll-load- failed) suggests that there's a mismatch between the ...
Python function to return listed imports gives empty result, but works line by line Question: Adapting code from [How to list imported modules?](http://stackoverflow.com/questions/4858100/how-to-list-imported- modules) to look like def imports(): import types Module = None ...
Python / Elaphe generates broken barcodes Question: I am trying to generate code128 barcodes using Python/Elaphe, which is based on Barcode Writer In Pure Postscript (BWIPP). Strangely, the barcodes generated by Elaphe don't match the ones generated by BWIPP and do not conform to code 128 standard. In particular, I tr...
Protect against null environment variables when using os.path.expandvars Question: How can I protect against Python's `os.path.expandvars()` treatment of null/unset environment variables? From [os.path](https://docs.python.org/2/library/os.path.html#os.path.expandvars): > Malformed variable names and references to no...
Gunicorn Django [CRITICAL] WORKER TIMEOUT Question: Since I did a pip install google-api-python-client I have my Gunicorn workers stoping after timeout. Django==1.5.3 Gunicorn==0.12.2 I'm not really sure if it comes from the pip but I did nothing particular except a database migration which migrated without error. ...
Recognition faces on a video using python Question: i have this code import cv2 import sys # Get user supplied values imagePath = sys.argv[1] cascPath = sys.argv[2] # Create the haar cascade faceCascade = cv2.CascadeClassifier(cascPath) # Read the image imag...
Selecting a Face and Extruding a Cube in Blender Via Python API Question: I am working on a project in which I will need to be able to extrude the faces of a cube via the python API. I have managed to extrude a plane via the API: import bpy bpy.data.objects['Cube'].select = True # Select the de...
Skip variable number of iterations in Python for loop Question: I have a list and a for loop such as these: mylist = ['foo','foo','foo','bar,'bar','hello'] for item in mylist: cp = mylist.count(item) print("You "+item+" are present in "+str(cp)+" copy(ies)") Output: ...
Acess Issue on Jira/Atlassian with R Question: I got a Atlassian/Jira account where projects are listed on. I would like to import the various issues in order to make some extra analysis. I found a way to connect to Atlassian/Jira and to import what I want on Python: from jira import JIRA imp...
Fuzzer for Python dictionaries Question: I am currently looking for a fuzzer for Python dictionaries. I am already aware of some fuzzing tools such as: * [Burp](https://portswigger.net/burp/) * [Peach](http://www.peachfuzzer.com/) However, they seem a bit broader of what I am looking for. Actually, my goal is to ...
Python 2.6 : piping bash commands containing python variables(inside python script) Question: I want to run the below bash command from my python script: stat --printf='%U%G%a' /tmp/file1.csv &&md5sum /tmp/file1.csv |awk '{print $1}' I have done it using `subprocess.Popen` as below: ...
Python: Multivariate Linear Regression: statsmodels.formula.api.ols() Question: I was trying to find the dependence of total power from various factors like temperature, humidity etc and had the following code: from functools import reduce dfs=[df1,df2,df4,df7] df_final = reduce(lambda left,right...
AttributeError: 'bool' object has no attribute 'count' Question: I am new to Python and I am writing this code below. fileName = input("Enter the file name: ") InputFile = open(fileName, 'r') text=InputFile.readable() sentences = text.count('.') + text.count('?') + \ text...
pytest: how to make dedicated test directory Question: I want next project structure: |--folder/ | |--tests/ | |--project/ Lets write simple example: |--test_pytest/ | |--tests/ | | |--test_sum.py | |--t_pytest/ | | |--sum.py | | |--__init__.py ...
Google TTS- Has anyone had any luck with it recently? Question: I've been trying my hand at a "JARVIS" like system on my Raspberry Pi 2. I've tinkered around with eSpeak, Festival and pico but I've found pico to be the best out of these. However, pico is very boring to listen to and is completely monotonous. Some site...
Import Cython exposed class from another directory Question: I have a Python project in which I want to make use of a `C++` class that I exposed through Cython (really, I just need a specific instance of the class, as the code below will demonstrate). Because there were a bunch of files associated with the class I deci...
Combine multiple .csv files with python from different directory paths Question: I am trying to combine multiple .csv files into one .csv file using the dataframe in pandas. the tricky part about this is, i need to grab multiple files from multiple days. Please let me know if this does not make sense. As it currently s...
Print time value in python Question: I am trying to print the contents of my dictionary with actual time values (for example, '6:00 AM') from my workbook. I get a different time format when I print from 'TimeSheet' than I do 'From'. How can I get the actual time value to print. [![enter image description here](http://...
TemplateNotFound when using Airflow's PostgresOperator with Jinja templating and SQL Question: When trying to use Airflow's templating capabilities (via Jinja2) with the PostgresOperator, I've been unable to get things to render. It's quite possible I'm doing something wrong, but I'm pretty lost as to what the issue mi...
Find numpy array values bounding an input value Question: I have a value, say 2016 and a sorted numpy array: `[2005, 2010, 2015, 2020, 2025, 2030]`. What is the pythonic way to find the 2 values in the array that bound 2016. In this case, the answer will be an array [2015, 2020]. Not sure how to do it other than loop,...
Python 3.5 install pyvenv Question: I am trying to get a virtual environment for a repo that requires python 3.5. I am using Debian, and from what I can tell, python 3.5 does not have an aptitude package. After reading some posts, it was recommended to download 3.5 source code and compile it. After running the make an...
Redirect log to file before process finished Question: test.py (work): import time _, a, b = [1, 2, 3] print a print b run the code: python test.py > test.log you will get the log in test.log test.py (not work): import time _, a, b = [1, 2, 3] print a ...
Tensorflow ImportError on OS X Question: TL;DR getting `ImportError: cannot import name pywrap_tensorflow ` when trying to use TensorFlow on El Capitan. Details: I followed the TensorFlow installation instructions for Mac OS X from [here](https://www.tensorflow.org/versions/r0.9/get_started/os_setup.html#pip- installa...
Opencv python error Question: I followed [this](http://www.samontab.com/web/2014/06/installing- opencv-2-4-9-in-ubuntu-14-04-lts/#comment-72178) to install opencv. When I tested the C and Java samples, they worked fine. But the python samples resulted in a import cv2 ImportError: No module named cv...
how to convert this curl command to some Python codes that do the same thing? Question: I am trying to download my data by using Fitbit API. I have figured out how to obtain a certain day's data, which is good. And here is the curl command I used: curl -i -H "Authorization: Bearer (here goes a very long ...
Pandas python updating values in a table based on preexisting values and conditions Question: I have a dataframe: import pandas as pd df=pd.DataFrame({ 'Player': ['John','John','John','Steve','Steve','Ted', 'James','Smitty','SmittyJr','DJ'], 'Name': ['A','B', 'A','B','B','C', 'A','D','D'...