I´m having some troubles on my code, that implements a function that verifies the lenght of a string and return that string with or without spaces. If String b >= 15 return b If strinf < 15 return “number os spaces until len(b)2 + string b But I get a IndexError: list index out of range Error. I c…
Get value of related object by list of fields in @property
I have two model like this with following fields: I Also I have this list of fields name: And finally I want to I create this @property: But for related objects this isn’t the correct way and I got this error: ‘Profile’ object has no attribute ‘address.postal_code’ How Can I use …
looking for the difference between ocurrences in a datframe
I have a dataframe like this (the real one is 7 million records and 345 features) the following image is only a small fraction related to if a cliente make an operation in a month. What I want to do is create a column at the end with the mean difference between each operation. For example in the first record
Update column based on other column condition
I need to update vid or maybe create a new column based on the change column df = [{‘vid’: 14, ‘change’: 0}, {‘vid’: 15, ‘change’: 1}, {‘vid’: 16, ‘change’: 0}, {‘vid’: 16, ‘change’: 0}, {‘vid’: 17, …
How Delete line In image with openCV
I have these images and I want to eliminate the lines that appear, so that the date remains without any other noise. How can I do it in python with openCV? 1.jpg 2.jpg 3.jpg Answer output:
How to split parallel corpora while keeping alignment?
I have two text files containing parallel text in two languages (potentially millions of lines). I am trying to generate random train/validate/test files from that single file, as train_test_split does in sklearn. However when I try to import it into pandas using read_csv I get errors from many of the lines b…
How do you eliminate items from nested lists
Given a list of ranked ballots and a list of candidates to eliminate, I need to return a new list of ranked ballots where all the candidates in the list of candidates to eliminate have been removed. This is the code I’ve tried so far My first doctest is failing, giving me this output instead: Answer Thi…
Pandas: Remove Column Based on Threshold Criteria
I have to solve this problem: Objective: Drops columns most of whose rows missing Inputs: 1. Dataframe df: Pandas dataframe 2. threshold: Determines which columns will be dropped. If threshold is .9, the columns with 90% missing value will be dropped Outputs: 1. Dataframe df with dropped columns (if no column…
Taking multiple prices on single page BS4
I’m creating an to help me learn but is also useful to me. I want to be able to parse multiple prices from (https://www.watchfinder.co.uk/search?q=114060&orderby=AgeNewToOld) one page, convert them to numbers and average them. The page will change so it could have 3 prices one day and 20 the next. T…
Configure Python Flask RESTplus app via TOML file
Based on the Configuration Handling Documents for Flask the section of Configuring from Files mentions a possibility to configure the App using files however it provides no example or mention of files that are not Python Files. Is it possible to configure apps via files like config.yml or config.toml? My Curr…