Sly32

Рейтинг
378
Регистрация
29.03.2012
Должность
Software engineer
Gerga:
Better as soon as possible to cut off the unnecessary data ...

Undoubtedly, the better. But there is business logic, and within it is not always possible

Well, that's an example of an example in this case, I will try to explain why it is not profitable to do at the database level. Request to postgress done 1 time, then the data stored in the radishes and various case studies I need to get different totals. The task - only one of them. I do not need every time to knock in the database, I am working with the already received collection.

Therefore it is necessary to solve by means of language and not talk - how else to do it.

tommy-gung:
here is the solution of the non-programmers))

I'm not interested in what is in Google - it was interesting to offer people to play with something more than customize plugins. Anyone who knows how to think - was involved and suggested solutions, babblers began to reason ...

at the end - the code in Python - the shortest and most readable)

Those who replied in essence - thanks for an interesting discussion)

---------- Posted 14.06.2020 at 13:24 ----------

timo-71:
Come on, probably joking.

Important, but I did not say that the complex or for seniors - so fun. I like to have spent more time writing tests than on the task itself)

Про data science была только шутка)

На пайтоне это будет одна строка

playbacks = filter(lambda _data: _data['media_category'] not in ['promo'], data)

About data science was just a joke)

Python on it will be one row

playbacks = filter (lambda _data: _data [ 'media_category'] not in [ 'promo'], data)

Gerga, Спасибо за ответ. В данном варианте вы исходные данные сначала будете должны преобразовать в строку и уже потом по ней делать поиск и замену, правильно?

Gerga, Thanks for the reply. In this embodiment, the source data, you will first need to convert to a string, and then later on it to do a search and replace, right?

Sitealert:
А я тебе показал, как получить правильные данные, исходя из твоего заявления

Если бы я мог фильтровать на уровне базы - я бы так и сделал, я работаю уже с полученными данными и не бегаю в базу каждый раз. Я же не стал уточнять, что данные хранятся в DynamoDB - noSQL базе и твой запрос вообще никак не поможет. Есть разные варианты и условия - в задаче нужно обработать один из них.

Если не хватает знаний - не стоит и лезть с непонятными ответами.

Sitealert:
And I showed you how to get the correct data, based on your statements

If I could filter at the base - I would have done, I have been working with the findings and do not run in each time base. I did not specify that the data stored in DynamoDB - noSQL basis of your request, and generally does not help. There are different options and conditions - for the problem to be treated is one of them.

If you do not have enough knowledge - do not climb and with unclear answers.

Sitealert:
Этой строкой я сразу сформирую нужный список. И не нужны будут никакие ужимки и прыжки.

Есть условие задачи, есть исходные данные - твой ответ ни разу не подходит под них. Я не вижу код, который могу запустить и посмотреть как он отрабатывает

---------- Добавлено 13.06.2020 в 15:24 ----------

danforth:
Sly32, перечитай я там выше писал, у тебя не JSON

Да, не JSON, это IterableObject, попытался универсально упростить. Исходные данные можно рассматривать как список json-ов, для упрощения и решать исходя из этого, что бы не привязываться к питоновским понятиям

Sitealert:
This line, I immediately will form the desired list. And you will not need any grimaces and jumps.

There is a condition of the problem, there is the original data - your answer is never fit them. I do not see the code that can run and see how it fulfills

---------- Posted 13.06.2020 at 15:24 ----------

Danforth:
Sly32, re-read it, I wrote above, you did not JSON

Yes, not the JSON, it IterableObject, tried universally simplified. The original data can be viewed as a list of json-s, to simplify and resolve on this basis, that would not be tied to the concepts of Python

danforth:
Ты меня спрашиваешь?) ответ можно как угодно формировать.

вопрос в конце - лишний. Понятно что можно, но хотелось бы чтоб на выходе был нужный мне списиок джейсонов


2009/11/10 23:00:00 {0 clip }
2009/11/10 23:00:00 {4 promo}
2009/11/10 23:00:00 {3 start }
2009/11/10 23:00:00 {3 video }
2009/11/10 23:00:00 {3 anime }
2009/11/10 23:00:00 {4 clip }
Всего: 7663