back soft

مطالب مرتبط با «python list of tuples» در back soft | نویسنده: استخدام کار

Android - Passing an ArrayList of Custom Objects to Another Activity

Vote count: 0 So, I've been struggling on this for a while and have searched on here for hours without finding anything that really helped. I have a custom class Streak. When the user creates a new Streak in my Main Activity, I want for that streak to be added to a list of total streaks, which I would then access from an AllStreaks activity. I have tried using Gson, but received errors. What I have below is working for the time being, but since my global variable has to be declared as new. I don...

ادامه مطلب

Why the mmap of Python is much slower than C++'s?

Vote count: 0 C++ code: #include #include #include #include #include using namespace std; #define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) int main() { timeval tv1, tv2, tv3, tve; gettimeofday(&tv1, 0); int size = 0x1000000; int fd = open("data", O_RDWR | O_CREAT | O_TRUNC, FILE_MODE); ftruncate(fd, size); char *data = (char *) mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); for(int i = 0; i < size; i++) { data[i] = 'S'; } munmap(data, size); close(fd); gettimeofday(&tv2, 0); ...

ادامه مطلب

How to get the Average of a specific category via Python

Vote count: 0 I was wondering how I could calculate the average of a specific category via Python? I have a csv file called demo.csv import pandas as pd import numpy as np #loading the data into data frame X = pd.read_csv('demo.csv') the two columns of interest are the "Category" and "Totals" column: Category Totals estimates 2 2777 0.43 4 1003 0.26 4 3473 0.65 4 2638 0.17 1 2855 0.74 0 2196 0.13 0 2630 0.91 2 2714 0.39 3 2472 0.51 0 1090 0.12 I'm interested in finding the average for the Totals...

ادامه مطلب

Shape of numpy array comparison with empty list

Vote count: 0 I have some problems understanding how python/numpy is casting array shapes when comparing to an empty list - which as far as I understand - is an implicit (element wise) comparison with False. In the following example the shape decreases by one in the last dimension, if it is not greater than 1. z = N.zeros((2,2,1)) z == [] >> array([], shape=(2, 2, 0), dtype=bool) z2 = N.zeros((2,2,2)) z2 ==[] >> False If, however, I compare with False directly, I get the expected output. z = N.z...

ادامه مطلب

ec2-describe-images how to list the creation date of ami for all the AMI's created by specific owner

Vote count: 0 I am using AWS CLI to get the list of AMI's created by specific owner however I want to get the creation date of the AMI along with the size of the AMI The command I am using is below. ec2-describe-images --filter "is-public=false" --filter "architecture=x86_64" --filter "owner-id=xxxxxxx" Please guide me. asked 23 secs agoNarendra522 Let's block ads!...

ادامه مطلب

Python - Having user sort list smallest to biggest

Vote count: 0 So I'm making a code where it asks the user to to swap two places on the list until the list is from smallest to biggest. So it should look like this: Hello: Your current list is [6, 7, 8, 2 , 9, 10, 12, 15, 16, 17] Please pick your first location -> 4 Please pick your second location -> 2 Your new list is [6, 2, 8, 7 , 9, 10, 12, 15, 16, 17] I've gotten to this part but I am currently unable to figure out how to get the USER to do the sorting and not the code. Your list is not sor...

ادامه مطلب

Python combine 2 lists of strings for CSV

Vote count: 0 I have two lists that I want to combine for csv output. alist = ['a', 'b', 'c'] blist = ['d', 'e', 'f'] However, I want the output for the csv to format like this: clist = ['a', 'b', 'c', 'd' 'e' 'f'] such that the last entry extended of the list contains the list of "blist", but will not be comma separated. Unfortunately, what I have been trying instead gives me: clist = ['a', 'b', 'c', 'def'] asked 1 min agoArca Let's block ads!...

ادامه مطلب

Need an excel macro that which can select data from drop down list and copy the contents of the entire sheet into a new work book

Vote count: 0 I have a dashboard which contains many formulas that change depending on the value on the drop down list. Is there any macro which can run a loop for all the values in the drop down list, copy the contents of the entire sheet and paste it into a new workbook? asked 31 secs agoadithya viswanathan Let's block ads!...

ادامه مطلب

Generate different totals of an image using a checkboxlist and user input

Vote count: 0 I have a barcode generator that takes information stored in a database and generates a barcode from a databound checkboxlist selection. There are different check boxes, the user checks the boxes of the items they want and enter a universal total. protected void btnGenerate_Click(object sender, EventArgs e) { int n; int i = Int32.Parse(BatchNumText.Text); for (n = 1; n...

ادامه مطلب

In C#, Rotate a List to The Right by the specified numbers of places without using LINQ?

Vote count: 0 I am trying to rotate a List of items to the right by the specified numbers of places without using LINQ, how am I able to do this? I think I am not understanding how to approach/solve this problem in particular. Here's what I have tried so far. public void Test(List items, int places) { items.RemoveAt(places); items.Add(places); } asked 1 min agoZerox Let's block ads!...

ادامه مطلب

How to create a list of record to mongoDb using expressJs

Vote count: 0 I want to create a array of object to mongoDb using expressJs (restful API ) . I have a array like this : [ { name: 'java', _id: 578c81ea7d5940501419e819, articles: [] }, { name: 'C#', _id: 578c81ea7d5940501419e81a, articles: [] }, { name: 'C++', _id: 578c81ea7d5940501419e81b, articles: [] }, { name: 'cloud', _id: 578c81ea7d5940501419e81c, articles: [] } ] How can I insert this array to mongoDB by only one function ? thanks for any help . asked just nowTrần Dương Let's block ads!...

ادامه مطلب

Python List of Strings to Tuple Paris

Vote count: 0 I am having some difficulty coming up with an efficient way of taking a list of strings and converting it to tuple pairs. I have a list similar to: listOfNames = ['red-l','blue-l','green-s','red-s','blue-s'] Every color in this example (red, blue, and green) has either a '-l' or '-s' entry or both. I need to convert this list of strings into tuple pairs such as: tupleOfNames = [('red-l','red-s'),(None,'green-s'),('blue-l','blue-s')] I think regular expressions is needed but I am no...

ادامه مطلب

python import of GdkPixBuf says "introspection typelib not found"

Vote count: 0 I have some imports : gi.require_version('Gtk', '3.0') from gi.repository import Gtk from gi.repository import Gdk, GdkPixBuf An error (maybe 2) is raised : WAING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files Traceback (most recent call last): File "", line 2158, in _find_spec AttributeError: 'DynamicImporter' object has no attribute 'find_spec' During handling of the above exc...

ادامه مطلب

Get value in list on python

Vote count: 0 See the code mult = [lambda x, i=i:x*i for i in range(4)] for v in mult: print(v) But my retu value is: can i get a real value? asked 42 secs agoGuilherme Almeida Let's block ads!...

ادامه مطلب

scrapy python code to list urls not appears to work as hoped

Vote count: 0 I am trying to write some code to scrap the website of a UK housebuilder to record a list of houses for sale. I am starting on the page http://www.persimmonhomes.com/sitemap and I have written one part of the code to list all the urls of the housebuilder developments and then the second part of the code to scrap from each of the urls to record prices etc. I know the second part works and I know that the first part lists out all the urls. But for some reason the urls listed by the f...

ادامه مطلب

How do you indicate certain elements in list of list and vectors based on list characteristics in R

Vote count: 0 For example testList0. If I run sapply(testList,function(x)is.list(x) & x[[3]]>1) I get Error in x[[3]] : subscript out of bounds. But really the problem is that the x[[3]]>1 should only be applied to the lists, not the vectors. The boolean needs to be of length testList. Any simple way of doing this? asked 40 secs agoColinTea Let's block ads!...

ادامه مطلب

How do I validate an implementation of python's IOBase?

Vote count: 0 Is there an existing test suite I can make use of to test an implementation of IOBase? If possible, I would like to exhaustively test a new implementation, but there are a lot of tests that would need to be manually written. For instance, say I have a non-seekable, non-writeable stream. I want to validate that my implementation of read is compliant and that all other methods raise the right kinds of errors. Such a class might look like this: import io class NonSeekableReader(io.Raw...

ادامه مطلب

How to create this kind of animation for a listview?

Vote count: 0 What I want to do I've got only the first animation: and it makes my list view item being removed and scaled. However, what I didn't figure out yet is how to build the second animation what push the rest of the items up. This is what I built:What I reached to do Thanks ahead! asked 1 min agoAssaf Zfani Let's block ads!...

ادامه مطلب

add navbar item in list accordin to width of page and the full of nav bar

Vote count: 0 i want to make a responsive navbar that is collapsed according to the number of items "li" not according to the width of the window i will attach some images to describe what i want to do. 1-case1:number of item not exceed the navbar width 2-number of item exceed the navbar width 3-if i collapse the window , the item in navbar must be added in dropdown list 4-if mobile ( less than 320) add all nav item in dropdown menu "bootstrap style} asked 30 secs agoGeorge Samuel Let's block ad...

ادامه مطلب

Sample code for listing a FixedPriceItem with ebay python api

Vote count: 0 i'm working with python 2.7 on a linux environment, my app working with the ebay trading api with the sdk: ebaysdk-python. My goal is to list a fixedpriceitem, i didn't found a correct way to do it ... It seems the example on the ebay website for the developer isn't working also. Someone out there can post a full working code written in python, to publish a fixedpriceitem with the ebaysdk-python api ? Thanks. asked 21 secs agoilmetu Let's block ads!...

ادامه مطلب