back soft

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

getting string array parse to date and get maximum and minimum of it in Python for java code

Vote count: 0 i am trying to write python functions to parse list or array of dates and sort it and then get max or min value from it. I have to call this functions around 4 million times and input to it will be passed from Amazon Redshift Database, for performance reasons i want to do this in Amazon Redhsift Database user defined functions. Below is Java Code needs to be converted into Python/Amazon Redshift user defined functions. public String doItMin(String v_effect_date){ java.util.List arr...

ادامه مطلب

Importing software in python error

Vote count: 0 importing procedure in python - utina@utinax55:~$ python Python 2.7.11+ (default, Apr 17 2016, 14:00:29) [GCC 5.3.1 20160413] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import lal Traceback (most recent call last): File "", line 1, in File "/home/utina/.local/lib/python2.7/site-packages/lal/__init__.py", line 2, in from .lal import * File "/home/utina/.local/lib/python2.7/site-packages/lal/lal.py", line 28, in _lal = swig_import_helper() Fi...

ادامه مطلب

Excel 2013 VBA - setting up a list of email reciepients (TO and CC) populating Oulook email

Vote count: 0 I have set up a Userform which saves data to the Incident Details data sheet and also saves data temporarily to a worksheet called 'Email Form' and laid out like a form so that the 'email form' is copied into the body of a MS Outlook email. This works perfectly, and with the current coding I was provided sends one email To 1 recipient and CC'd to another, but I need to send same email to multiple recipients. I have created another sheet called ‘Email Recipient List (same workbook) ...

ادامه مطلب

Is it possible to change the event type of an event listener in Firebase during runtime?

Vote count: 0 For example, I called a listener once with a .ChildAdded event type but later I want to call that same listener again with a .ChildRemoved listener. asked 15 secs agokeyhoffman Let's block ads!...

ادامه مطلب

Get match of two lists

Vote count: 0 I have two lists and i like to browse them to get the matchs and the difference but i don't understand why my index don't reach the end of list there is my code: recordedEvents=[u'/app//wakeup', u'/app/hdmi/state', u'/homepage/ws/view', u'/homepage//activate', u'/live//activate', u'/live//zap', u'/live/ctazap/view', u'/live/ppluspminus/zap', u'/app//keypress', u'/app//keypress', u'/app//keypress', u'/app//keypress', u'/app//keypress', u'/app//keypress', u'/live/virtualzappinglistba...

ادامه مطلب

Getting java.lang.NoClassDefFoundError: com/gargoylesoftware/htmlunit/WebWindowListener when using HTMLUnitDriver

Vote count: 0 I am trying to use HTMLUnitDriver in my selenium test to understand how HTMLUnitDriver works. Kindly help me with resolving the issue. I have added the below jars to the build path in eclipse selenium-java-2.53.0 jars TestNG jar Added the below jars as these were mentioned in other posts as a solution to the error I encountered. However, the issue remains. selenium-htmlunit-driver-2.52.0 jar selenium-server-standalone-2.53.0 Hi, I am trying to use HTMLUnitDriver in my selenium test...

ادامه مطلب

What is the correct css for the list of results to show correctly in this situation?

Vote count: 0 What is the correct css for the list of results to show correctly? Here are the steps to view the results: 1) Navigate to http://mypubguide.com/good-pubs/east-region 2) Type "Hull" in the search input on the navigation bar and enter 3) Check: You see a list of results but the styling is incorrect, e.g., the anchor tag is not showing the text correctly and other elements look badly formatted. How I resolve this? asked 40 secs agoCaotaurus Let's block ads!...

ادامه مطلب

Create dataframe of all rows AFTER varying amount of header data Python Pandas

Vote count: 0 I have dataframes with a varying amount of header data. I need to remove the header data, (ie. create a new dataframe containing only the data that comes after this header) I have used the following code to find the row where the header data ends. df = xlsx_file.parse('ActualSheet',header= None) value_list = ['var1','var2'] df_Header = df[df[0].isin(value_list) & (df[1].isin(value_list))] The above code works and creates a dataframe of the final row of header data. I am having trou...

ادامه مطلب

SWIG: How to pass list of complex from c++ to python

Vote count: 0 I have a function in c++ who retus a list of complex: #include std::list< std::complex > func(...); what should i do in the '*.i' file ? asked 34 secs agoxhao79 Let's block ads!...

ادامه مطلب

How to constuct a column of data frame recursively with pandas-python?

Vote count: 0 Give such a data frame df: id_ val 11111 12 12003 22 88763 19 43721 77 ... I wish to add a column diff to df, and each row of it equals to, let's say, the val in that row minus the diff in the previous row and multiply 0.4 and then add diff in the previous day: diff = (val - diff_previousDay) * 0.4 + diff_previousDay And the diff in the first row equals to val * 4 in that row. That is, the expected df should be: id_ val diff 11111 12 4.8 12003 22 11.68 88763 19 14.608 43721 77 ... ...

ادامه مطلب

How can I concatenate a big list of unique words once?

Vote count: 0 It is hard to explain what I am trying to say so I am best off giving an example. Lets say I had the following data - word1, word2word3, word4 What I would need is an output is the following - word1 word2word1 word3word1 word4word2 word1word2 word3word2 word4word3 word1word3 word2word3 word4word4 word1word4 word2word4 word3 So a complete mix of all the combinations of words. In total I have 300x300 rows and columns so I know it will be a big result but do not know the best way to g...

ادامه مطلب

Python exception "can't multiply sequence by non-int of type 'float'

Vote count: 0 My 12 year old is leaing python scripting. He is writing a very simple code to calculate the discount on a article. Following is the code and it throws the exception on the 3rd line in the code. The exception is: Traceback (most recent call last): File "C:/Users/basam/AppData/Local/Programs/Python/Python35/discounts.py", line 3, in discount=0.1*price TypeError: can't multiply sequence by non-int of type 'float' price=input('how much is your item?') if int(price)...

ادامه مطلب

How to know if a variable is in an attribute of an object in a list?

Vote count: 0 To check if a variable is in a list, I know that one can use if variable in list. In my instance, I have a list of objects, all of which have the attribute "id", I want to check if an object in a list has a specific ID, but I'm not sure how I would go about doing that. I already tried looking this up on google as well as here but I couldn't find any relevant results. That might be because I don't really know how to phrase my question correctly, so if my question doesn't make sense ...

ادامه مطلب

Python n elements from list by index

Vote count: 0 Question: I have a list of arrays such as: a = [array([0, 4]), array([1, 3, 2])] From another variable X, I want to take two subsets which are chosen by the index in each array in a. X = [0.1, 0.7, 0.9, 0.2, 0.3] What I want to have is now: result_1 = [0.1, 0.3] result_2 = [0.7, 0.2, 0.9] My solution would be to use a for loop such as: def getresult(X, indices): result = [] for i in indices: result.append(X[i]) retu result This works fine: getresult(X, a[0]) [0.1, 0.3] My previous ...

ادامه مطلب

How to find the index number of list that in dictionary?

Vote count: 0 The example list { 'date': array(['06/08/2016', '06/09/2016', '06/10/2016']), 'close': array([ 923.13, 914.25, 909.42]) } I try to get the Date of close is 914.25 that is list['date'][2] but i don't know how to get index 2 for close. Thank you. asked 3 mins agoBarbiyong 1 Answer Vote count: 0 You can solve it with zip() and next(): >>> d = { ... 'date': ['06/08/2016', '06/09/2016', '06/10/2016'], ... 'close': [ 923.13, 914.25, 909.42] ... } >>> a = 914.25 >>> next(date for date, am...

ادامه مطلب

Inserting a list of financial data into MySQL via Python

Vote count: 0 Using Python and ystockquote - I import a dictionary of around 80+ values of financial data. I've setup a MySQL table with receiving columns with values like - previous_close, shares_owned, change_from_52_week_low. I'm getting stuck on sending the data from Python as a list to MySQL. I have broken the dictionary into just the values - so that the Python list would be all that is imported into the SQL table. What do I need to get the list of Python retus into the respective MySQL co...

ادامه مطلب

Rapid compression of multiple lists with value addition

Vote count: 0 I am looking for a pythonic way to iterate through a large number of lists and use the index of repeated values from one list to calculate a total value from the values with the same index in another list. For example, say I have two lists a = [ 1, 2, 3, 1, 2, 3, 1, 2, 3] b = [ 1, 2, 3, 4, 5, 6, 7, 8, 9] What I want to do is find the unique values in a, and then add together the corresponding values from b with the same index. My attempt, which is quite slow, is as follows: a1=list...

ادامه مطلب

Is Thread.sleep() waste of time for listening in Java?

Vote count: 0 Suppose I have a nametag, which is UI component in GUI program. The nametag will constantly change its text based on the data. If the user change his/her name data, then he/she will see the change in nametag. For this task, my code looks like this: Thread thread = new Thread(new Ruable(){ @Override public void run() { while (true){ String name = data.getName(); nametag.setText(name); try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } }); Since th...

ادامه مطلب

Center Pop Up Menu in clicked row of list

Vote count: 0 I want that my pop up menu appear next to the clicked row. Look at the picture after I click the "..." button: http://postimg.org/image/s35znsaq3/ This is my code for the Pop Up Menu: private void showPopUpMenu(final User user) { View menuItemView = findViewById(R.id.moreActions); PopupMenu popUpMenu = new PopupMenu(ContactsListActivity.this, menuItemView); popUpMenu.getMenuInflater().inflate(R.menu.pop_up_menu, popUpMenu.getMenu()); // Hide buttons for missing user's information M...

ادامه مطلب

List of tuple to string in Python

Vote count: 0 I have a list like this: l = ['b', '7', 'a', 'e', 'a', '6', 'a', '7', '9', 'c', '7', 'b', '6', '9', '9', 'd', '7', '5', '2', '4', 'c', '7', '8', 'b', '3', 'f', 'f', '7', 'b', '9', '4', '4'] and I want to make a string from it like this: 7bea6a7ac9b796d957427cb8f37f9b44 I did: l = (zip(l[1:], l)[::2]) s = [] for ll in l: s += ll print ''.join(s) But is there any simpler way? May be, in one line? asked 1 min agopushpen.paul Let's block ads!...

ادامه مطلب