Skip to main content

Posts

How to match more than 2 number in a row?

I have 2 data frames that I would like to match more than 2 numbers that match in the row I'm looking up. import pandas as pd cols = ['Num1','Num2','Num3','Num4','Num5','Num6'] df1 = pd.DataFrame([[2,4,6,8,9,10]], columns=cols) df2 = pd.DataFrame([[1,1,2,4,5,6,8], [2,5,6,20,22,23,34], [3,8,12,13,34,45,46], [4,9,10,14,29,32,33], [5,1,22,13,23,33,35], [6,1,6,7,8,9,10], [7,0,2,3,5,6,8]], columns = ['Id','Num1','Num2','Num3','Num4','Num5','Num6']) I have this code that matches but i would like to enhance by matching more than 2 numbers in the row. # convert the values in the first dataframe to a list vals_to_find = df1.iloc[0].tolist() # Print the values to find print("Vals to find:", vals_to_find) # Create an empty list to hold the matching IDs matc

ElasticSearch doesn't work when multiple words don't have space

When I'm trying to search using Loremipsum it's returning empty array. I would like to get Lorem ipsum dolor using Loremipsum query. value Lorem ipsum dolor query GET favorite_candy/_search { "query": { "multi_match": { "query": "Loremipsum" } } } result "hits" : [ ] Via Active questions tagged javascript - Stack Overflow https://ift.tt/2y0twRG

Tkinter Buttons Created in a for loops but can't reference data

I have a tkinter project i'm working on. The end goal is to have a Window appear that has all of the data in a json file appear as individual objects (either a button or next to a button) that can then be clicked to have the data altered and saved back to the json file as well as an option to add new levels. What makes this complicated is that because I'm making it "future proof", i have to create the buttons in a loop, so their names are not defined for me to reference later. I've tried using cget(), passing them through a validation in tkinter, v.focus_get(), and none of them come up correct. For a second i thought that .grid() being on the same line might make me reference the grid object, while not wrong, changing that did not fix the issue. Using cget() gave me "." as whatever information i try to pull. I'm not married to my formatting, it can be a pop up window, through text boxes, i just don't want to put it all in a listbox with all of

How to disable mouse wheel scrolling over a type "number" input in React?

I'm using MUI type="number" textfields, but when I focus it and then scroll the mousewheel, the value of the input changes. I've readed about adding Blur after scroll, but I don't wanna blur the field. I've readed too about adding Blur and Focus again, but the behaviour isn't good enough. Could somebody help me? Thanks a lot! :) I'm using React 18 & MUI v5. To reproduce this behaviour, you can go to https://mui.com/material-ui/react-text-field/ , click in a type number textfield, and then scroll OVER the field. You will see how the value changes. I've tried using blur and focus, but this behaviour is not good enough Via Active questions tagged javascript - Stack Overflow https://ift.tt/2y0twRG

Signals django not working on ubuntu server

I have a site on the server where I work with signals.py The problem is that when I add a db file through the admin panel signals.py does not work EXACTLY ON THE SERVER on my computer everything works fine But there is another model involving signals.py and it works great models.py The model that works class History(models.Model): tg_id = models.BigIntegerField(verbose_name='Telegram ID') amount = models.FloatField(verbose_name='Кол-во') date = models.DateTimeField(verbose_name='Дата транзакции') Problem model class database_sqlite3(models.Model): file = models.FileField(verbose_name='Файл', upload_to='db_file/', help_text='Вы можете добавить сюда базу пользователей') app.py from django.apps import AppConfig class MainConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'main' verbose_name = "Бот" def ready(self):

JavaScript only works for the first item and doesn't work for the other items

balde @foreach ($products as $product) <div class="col-lg-4 col-12"> <!-- small box --> <div class="small-box bg-info"> <div class="inner"> <h3></h3> <p>Price: €</p> </div> <div class="icon"> <i class="ion ion-bag"></i> </div> @if($product->codes()->count() > 0) <a href="javascript:void(0);" data-toggle="modal" data-target="#product" class="small-box-footer">Order <i class="fas fa-arrow-circle-right"></i></a> @else <p class="small-box-footer text-warning">Out of Stock <i class="fas fa-times-circle"></i></p> @endif

Macro tasks queue VS Callback queue

I need to know if there is a difference between the 2 of them if someone can tell me what operations (in details) gets added to the macro queue and what operations gets added to the micro fetch function gets added to what? i saw here that fetch gets added to the micro task queue PHOTO: his explanation -- BUT HOW? - i added a comment there... PHOTO: my comment there i tried searching the web and everybody talks about micro vs callback queue which is obvious. but no one made it clear that callback queue and macro queue are the same or different Via Active questions tagged javascript - Stack Overflow https://ift.tt/ADdXZl2