All Questions
Tagged with python-2.7 arrays
938
questions
0
votes
2
answers
101
views
How can I store a function in an array in python?
I am trying to to store a function in an array and store that array in a dictionary so I can later call values from that array through the dictionary.
I created a zeros array and created a loop that ...
0
votes
2
answers
94
views
Making a Diagonal matrix with desired shape
How to make a random elements digonal matrix in a numpy array with the desired shape, for example I want to make F to be a numpy array with shape (3, 2, 4, 4), and the diagonal matrix dimensions 4*4 ...
0
votes
1
answer
40
views
How can i add the column name in every sheet of excel file in python
I have 6 sheets in my excel file and i need to copy the date from file name and append the same in every sheet as new column as date.but with this code i can change only in first sheet.
import os
...
-2
votes
2
answers
146
views
Sort the coordinates of points by areas that they occupy (Python)
Suppose we have a particular number of points distributed in the plane at the nodes of a grid having a given step. These points form several continuous regions.
We can tell that points (if there is ...
0
votes
1
answer
52
views
How to replace values in array b by indexes from array a ? [numpy]
For example, there is an array a.
a = [
[1,2]
]
And array b.
b = [
[[0,0,0],[0,0,0]]
]
How can I replace the values in array b with indexes from array a by 1 ?
That is, the ...
-5
votes
2
answers
1k
views
In Python in what ways can u make an empty NumPy array? [closed]
(https://i.sstatic.net/eakU9.jpg)
To make an empty Numpy the array
0
votes
1
answer
206
views
TypeError: Object of type 'ndarray' is not JSON serializable
import json
def get_dict_feature_name(terms):
feature_name = {}
feature_name['feature'] = terms
return feature_name
def save_to_json(Data, json_filename):
with open(...
0
votes
1
answer
3k
views
How can I read image name from a specific folder?
I want read image name like flower.png unnamed.png. Is there any way that I can read all images images one by one like we can read text file with open ("data.txt", "r") as myfile:
...
1
vote
2
answers
566
views
timm: typeError: 'builtin_function_or_method' object is not subscriptable
I am implementing timm tutorials on data augmentation to increase the number of images of my dataset. According to their tutorials, I have implemented same code but it did not work.
Code
import numpy ...
-3
votes
1
answer
127
views
How to shuffle a list with specific order ? and i also want user input and simple solution
Write a program to have a function called triple_shuffle () that takes three lists of the same size and shuffles them concurrently.
Given list like [10,20,30,40,50], [11,22,33,44,55], and [19,18,17,16,...
-1
votes
1
answer
58
views
python program to get n unique sequence number within a range
the input is the range and total number needed.
consider input range is (0,1)
if the total number needed is 10.Then output should be an array containing 10 values between 0 to 1. including 0 and 1.
if ...
0
votes
4
answers
45
views
I want to compare list of two cities and if list B cities are not present in list A then should append in list A using python
A=['mumbai','delhi','jaipur']
B=['mumbai','kolkata','pune']
I want to compare list A and list B and if list B cities are not in list A then we should able to append those cities in list A
0
votes
1
answer
72
views
convert 3 bytes to signed integer with python2
I am trying to convert 3 bytes to an signed integer.
on python3 I can simply do the following
s = bytearray.fromhex('fcffff')
print(s, int.from_bytes(s, "little", signed=True))
==-4
I ...
1
vote
2
answers
3k
views
Array updating problem for using map(int,input().split()) in python [duplicate]
for taking list input in the array I used
map(int,input().split())
but for using this input method I can't modify the array if I Iterated like a[I] then it shows
TypeError: 'map' object is not ...
0
votes
1
answer
81
views
Syntax Error:Creating An 2d List Filled With Zero
How Could I Initialize An 2D List Filled With Zeroes Without Any Additional Library/Module
here what is my attempt
table = [0 for i in range(amount + 1)[0 for j in range(len(coins))]]
it works in ...