Python or expression on exception
I have this code:try: info_model = Doc2Vec.load('models/info_model') salary_model = Doc2Vec.load('models/salary_model') education_model = Doc2Vec.load('models/education_model') experience_model =...
View ArticleGet finished level distribution across the database
I have a table that stores data of players game sessions. I need to count how many players finished each level of a game. Table have this structure`player_id, player_level, online_time, offline_time,...
View ArticleFinding Pearson correlation for millions of records
I am doing an NLP task, where I have a distribution of word occurrence in the texts grouped by day. I want to find Pearson correlation between a given word and all other words in the database. Is there...
View ArticleReload Enum class on call
I have enum class, that is generated based on distinct names in Postgres table, like this.CustomProperty = StrEnum('CustomProperty', [(i['metric_name'], i['metric_name']) for i in...
View ArticleSplit list according to the rule
I have a list values_list = [1013.0, 683.0, 336.0, 406.0, 636.0, 1065.0, 1160.0]Also I have a valuevalue = 660.6153846153846This list is based on the assumption that there are 3 stages. First stage...
View ArticleFind sequences in list of ranges
I have a random length list that contains ranges info:list = [ [[7, 12], [6, 12], [38, 44], [25, 30], [25, 29]], [[0, 5], [1, 5], [2, 5], [12, 16], [13, 16], [20, 23], [29, 33], [30, 33]], [[5, 7], [6,...
View ArticleSliding window reports caching
I have api endpoint that takes as an input some data with "date_from" and "date_to" fields.When the request is made it initiates the generation of report. These "date_from" and "date_to" fields are...
View ArticleNormalize column in ClickHouse
Is there a possibility a to normalize a column in Clickhouse?I was trying to do it getting the column into array via groupArray and then using arrayMap with lambda function arrayMap(x ->...
View ArticleAnswer by Graygood for How to convert string number to int and avoid the...
You could try something like this:array = ["String", "12"]for item in array: try: int(item) print(f"{item} is not string") except: print(f"{item} is string")
View ArticleAnswer by Graygood for How to solve Unicode problem in flask production e.g....
You could try using string.encode('utf-8').decode('utf-8') before passing it to jsonify function
View Articleflock with crontab is not working properly
I have a crontab job, that looks like this:*/5 * * * * /usr/bin/flock -w 0 /home/partners_perfluence_delivery/cron.lock cd /home/partners_perfluence_delivery && /usr/bin/python3...
View ArticleSelect only rows with max date
In clickhouse table I have multiple rows for one _id. What I want is to get only one row for each _id where column _status_set_at has its max value. That's what I am currently at:SELECT _id,...
View Article