All Questions
378 questions
-2
votes
4
answers
91
views
Sequence Addition
Mr. Ric feels that alternating the schedule for paying for gasoline only disadvantages him. So Mr. Dip proposed a waytodivide the paymentschedule. For every 2n, they will change the pattern by ...
1
vote
4
answers
138
views
Can these two Python functions be replaced by a single generic one taking either a list or a tuple argument?
Can these two Python functions:
def negativeList(a):
return [-e for e in a]
def negativeTuple(a):
return tuple(-e for e in a)
be replaced by an equvalent single generic function negative(a)?
0
votes
0
answers
34
views
Python function : return array that was named automatically [duplicate]
My final goal is to recover data from a table, and store it in numpy arrays to work with it later.
I had to automatically name each columns of my dataframe (I've opened my file using pandas) due to my ...
-1
votes
3
answers
93
views
Changing array elements by indexing
I have a list/array which has elements which need to be changed now and then. I changed elements in the list by indexing, and when I print out the list, it the changes have been made.
l = stdarray....
1
vote
1
answer
238
views
TypeError: 'numpy.complex128' object is not iterable np.arrays basic question does not make sense
I have problem with something very basic but I am already one hour trying to find out what's wrong and can't not, so I am here asking for help.
I have an array _ which is equal to:
array([-0.44723986+...
0
votes
1
answer
168
views
How can I find the number of days that have elapsed between two dates?
I have already created functions to check whether a year is leap year or not is_leap_year and another function ordinal_date that checks the number of day a date is in a year.
I am now trying to create ...
0
votes
1
answer
169
views
Worksheet object not callable OpenpyXL error
I'm trying to create a function that loads an excel sheet row into an array but keep on running into this error.
Code:
from openpyxl import Workbook
oldworkbook = load_workbook(filename="111.xlsx&...
-2
votes
2
answers
62
views
Give a "smart" way to number an array
I have this problem where i want to give an ID number to each element in array. For example:
# case 1
#points z f
#index: 0 1 2 3 4 5 6 7 8 9 10
#...
-3
votes
6
answers
101
views
the function is not returning any value
the problem is -- Given a list of ints, return True if the array contains a 3 next to a 3 somewhere.
Given a list of ints, return True if the array contains a 3 next to a 3 somewhere.
def has_33(list):...
3
votes
1
answer
924
views
How to create a function which applies lag to a numpy array in python?
Here are 3 numpy arrays with some numbers:
import numpy as np
arr_a = np.array([[0.1, 0.2, 0.3, 0.4],
[0.2, 0.3, 0.4, 0.5],
[0.3, 0.4, 0.5, 0.6],
...
1
vote
5
answers
131
views
Can I reduce elif instructions in my python code?
I'm currently learning python and I was wondering whether I could reduce elif instructions in my code.
Here's a problem description:
SUMMER OF '69: Return the sum of the numbers in the array, except ...
1
vote
2
answers
158
views
Finding sum of a function u=n*x*y for n =[ 0 to N] ; x and y are some array
I want to write a code using python for solving a function such as follows :
u = sum(n*x*y) for n=[0 to N]
Let's say x = [1,2,3,4,5] and y =[6,7,8,9,10] and n= [1,2,..100]
I expect an output like ...
0
votes
1
answer
354
views
How to call python function with arguments from C# and get a return value
Hello I am trying to call below python function "mclp" from C#
import numpy as np
from scipy.spatial import distance_matrix
from gurobipy import *
from scipy.spatial import ConvexHull
from ...
-1
votes
1
answer
262
views
How to call a function from an array of functions
What I want to do is to have an function called from an array of function. I did my homework and came across this stackOverflow question.
https://stackoverflow.com/questions/30549292/in-python-how-do-...
-3
votes
1
answer
60
views
Can someone explain why this function returns None?
I've been trying to figure out why this function is returning None every time I run it, I would appreciate a lot if someone could explain my why.
x = set([1,2,3])
def inserta(multiconjunto, elemento):...