I am working on data looking at the degeneration of neurites in Neurons derived from human stem cells. The output data is a pair of images, one "before" picture of long, healthy neurites, and one "after" picture of broken, dystrophic neurites. We hav... more
I'm trying to set a voice notification in a Jupyter cell right after a python code by using a bash command:
#Some python code
say -v Daniel The programm execution has been finished
But that raises syntax error.
What would be the right wa... more
I have 1 million keywords, and I wanna write program that define category for every keyword via neural network. To learn my program, I need get texts (50-100) for every keyword. To get texts I need get URLs for keywords via search engine -- google, y... more
I'm trying to make a function that opens a textfile, counts the words and then returns the top 7 words in percent. However when I run the code with "return" it only retrieves the first value but "print" gives me what I need + a "None".
def count_wfr... more
For the last few months i've been working on a Rest API for a web app for the company I work for. The endpoints supply data such as transaction history, user data, and data for support tickets. However, I keep running into one issue that always seems... more
I am trying to understand the variable scope in Python (3.x), but below is an example of code that does not work and I am not sure why.
Which results in NameError: ... more
Regards. I have a question pertain to this simple code and its result.
order = 0;
self.x = 1;
name.order += 1;
name.order -= 1;
The n... more
I want to have the button's image cycle through all possible pizza images, but instead it throws the following error when I click on it:
AttributeError: 'buttonInitialize' object has no attribute 'config'
I have a numpy array X, and I'd like to return another array Y whose entries are the indices of the n largest values of X i.e. suppose I have:
a =np.array[[1, 3, 5], [4, 5 ,6], [9, 1, 7]]
then say, if I want the first 5 "maxs"'s indices-here 9, 7 ... more
I am getting a different result when I run this code in my terminal vs. a Jupyter Notebook. Both are using Python 3.6 and numpy 1.13.1.
Terminal (correct solution):
>>> import numpy as np
>>> vector_one = np.asarray([
Two separate issues have come up with my code
First, I can't get the fourth row of my grid to appear, although the fifth appears to be displaying just fine.
Secondly, my passVal function keeps giving me the error:
passVal() takes 1 positional argu... more
I am trying to create a file writer based on Pandas' ExcelWriter. I proceeded as I usually do with classes in Python (3) with inheritance:
import pandas as pd
def __init__(self, fname, engine='openpyxl'):
df = pd.DataFrame([[3,3,3]]*4,index=['a','b','c','d'])
While we can extract a copy of a section of an index via specifying row numbers like below:
Unfortunately we can't extract a copy of a section of an index via speci... more
I usually program on windows (at work) or linux (free time).
Now im doing a project for my wife, and she uses a mac.
In this project there is a QTabWidget with closeable tabs.
On windows the close icon appears properly, and as excepted, however on M... more
Hi all I am new to pandas. I need some help regarding how to write pandas query for my required output.
I want to retrieve output data like
when 0 < minimum_age < 10 i need to get sum(population) for that 0 to 10 only
when 10 < minimum_ag... more
I cannot figure out why the if statement in the main() function is throwing error every time instead of checking the variable userChoice like it should. Unless it is and I am just missing something obvious.
PI = 3.14159
def printGreeti... more
I'm building a script to analyse performance data output from multiple log files. I managed to create a list of lists with all events and their timestamps, next step I need to sort this list of lists on the timestamp per event. So far so good I googl... more
I am currently implementing an AI playing a simple board game (5 in a row) in Python 3.6. The board is 7x7 and each field can contain either a black or a white stone.
To simplify the problem, I want to treat rotated or flipped board positions the sa... more
I have created a package to quickly transform datas using pandas and xlsxwriter.
This worked pretty well and I did a few functions successfully. But recently I've hit a wall:
For a few functions I need to define variables first but they are not basi... more
Within numpy.ndarray.reshape, the shape parameter is an int or tuple of ints, and
The new shape should be compatible with the original shape. If an
integer, then the result will be a 1-D array of that length.
The documentation signature is j... more
Problem: One function is reading a configuration file and setting up a lot of variables accordenly.
Several other functions needs several of these variables to do there job.
Best practice says, Global variables are a no-go, so I was thinking what al... more
I aimed to prevent negative indexing in arrays.
import numpy as np
class Myarray (np.ndarray):
Wondering whether anyone has any ideas on this?
When I run the following script it always creates the handshake with the SMTP and then cancels mid-process with the error "SMTPServerDisconnected: Connection unexpectedly closed"?
##Email addresses f... more
i have one problem with my code in python3 :
i tried many solutions but still the same result.
from concurrent import futures
I have a Unordered list class like this :
from node import Node
self.head = None
return self.head == None
def __len__(se... more
I have the following code:
from numpy import random
def __init__(self, name, age=random.randint(18,65)):
self.name = name
self.age = age
I want age to be a random number between 18 and 65, unless explicitly sp... more
I'm working with images in numpy array form. I need to serialize/deserialize them to/from JSON (I'm using MongoDB)
numpy arrays cannot be serialized with json.dump; I am aware of this but I wonder if there is a better way, since the conversion of a ... more
I have wrapped a small C library in Cython, and can successfully call it from Python. Here's a simplified example representing how this is as of now:
cdef extern from "my_c_library.h":
int function2(int... more
I am using the following code to normalize a numeric pandas data frame.
df_norm = (input_df - input_df.mean()) / (input_df.max() - input_df.min())
Now I have a new data frame, the first two columns are string. I want to ignore the first two column... more
I am trying to fill missing values with previous value but only if the previous value is repeating?