I’ve got a program to find DNA matches. We’ve been given a one line text file for finding the longest sequence of STR(Short Tandem Repeats) then match the result with a database which has been a .cvs file as below: After getting results for longest sequence amounts(as integer) I’m trying to …
how to build a tree for ordered numbers?
I am trying build a tree (dictionary ) from input numbers. My main criteria for the tree is all the nodes in a level are in a same range. ( a series of data from parent) I think you will get idea from my examples- Please see the example I tried to build a tree initially. This will work only
Reference last object that was called?
Im sure this was asked before, but when searching for it i only found questions like “reference last object in a list” However, i am looking for something to make this example code not redundant – in this example i have to use two very long variables: I know that powershell has $_., and im w…
Equidistant timeseries filling the blanks
I have the following code that generates a timeseries with 1 min steps but would like to have the time gaps filled. i.e 13:58 is missing in between. Every ip should be represented in the gap with zero values. How can this be achieved? Answer First change unstack by first level for DatetimeIndex, and add DataF…
Python: how can I change amount_sold and price_per_unit from string to int
I want to change amount_sold and price_per_unit from string to int but its error. After I zipped the data, each attribute becomes a tuple. Then, I try to change to list by using this code (list(amount_sold)) but it resulting in an error Answer I’m not sure if I’ve got this right because you don…
Plot group averages for each rating on 4 separate plots
I have 4 groups (research, sales, manu, hr) and each group has 2 categories (0 & 1). I am trying to plot the average scores for each group in the features in the list ratings. The code that gives me the means looks like this (with depts = [‘research’, ‘sales’, ‘manu’, &…
Unique lists within list of lists if those lists have list as one of the elements
If I have: What would be the best way to get: If I try: I get TypeError: unhashable type: ‘list’. I don’t want to remove all layers of nesting, because that would just combine everything into one list: Output: If two instructors have the same count (i.e. 3 in this case), then only one 3 rema…
How to merge two dataframes and eliminate dupes
I am trying to merge two dataframes together. One has 1.5M rows and one has 15M rows. I was expecting the merged dataframe to haev 15M rows, but it actually has 178M rows!! I think my merge is doing some kind of Cartesian product, and this isn not what I want. This is what I tried, and got 178M rows.
Convert result of sum of timedeltas in Python
I have the output below from a sum of a timedelta list in a column on my dataframe. How do I get values converted to hours minutes and total seconds? Answer afaik, there’s no built-in functionality for this. But you can create your own. For example for formatting to a string in H:M:S format or splitting…
Can’t convert curl to python request
I copied request as CURL with help of dev-tools and received: Copied request to console (curl works fine). Received result Converted curl to python requests with help of https://curl.trillworks.com/ Received: Tried this code and received error Body is not valid Latin-1. Use body.encode(‘utf-8’) if…