question_id int64 59.5M 79.7M | creation_date stringdate 2020-01-01 00:00:00 2025-07-15 00:00:00 | link stringlengths 60 163 | question stringlengths 53 28.9k | accepted_answer stringlengths 26 29.3k | question_vote int64 1 410 | answer_vote int64 -9 482 |
|---|---|---|---|---|---|---|
77,347,986 | 2023-10-23 | https://stackoverflow.com/questions/77347986/how-to-remove-the-top-and-bottom-e-g-10-of-data-from-dataframe | How can you filter a DataFrame in pandas by selecting rows that fall within the 10th and 90th percentiles based on a specific column and then remove these filtered rows from the original DataFrame? Code Example: # Create a sample DataFrame data = { 'A': [0, 0, 0, 0, 0, 172, 183, 92, 105, 120], 'B': [3, 14, 27, 33, 41, ... | Using percentiles won't guarantee having a fixed number of rows. It rather looks like you want to take 80% of the ranked values. Using rank with 'first' and between: m = (df['A'] .rank(method='first').sub(1) .between(0.1*len(df), 0.9*len(df), inclusive='left') ) out = df[m] Output: A B 1 0 14 2 0 27 3 0 33 4 0 41 5 1... | 2 | 2 |
77,345,121 | 2023-10-23 | https://stackoverflow.com/questions/77345121/azure-openai-langchain-invalidfield-the-vector-field-content-vector-must-h | I'm trying to create an embedding vector database with some .txt documents in my local folder. In particular I'm following this tutorial from the official page of LangChain: LangChain - Azure Cognitive Search and Azure OpenAI. I have followed all the steps of the tutorial and this is my Python script: # From https://py... | Please use pip install azure-search-documents==11.4.0b8 to ensure you are using the azure cognitive search python SDK compatible with LangChain. | 2 | 4 |
77,346,782 | 2023-10-23 | https://stackoverflow.com/questions/77346782/django-create-connected-objects-simultaneously | I'm new to Django and wanted to ask how can I solve a problem that I have class InventoryId(models.Model): inventory_id = models.AutoField(primary_key=True) class Laptop(models.Model): name = models.CharField(max_length=30) inventory_id = models.ForeignKey(InventoryId, on_delete=models.CASCADE) class Desktop(models.Mod... | Use model inheritance [Django-doc] instead: class InventoryItem(models.Model): inventory_id = models.AutoField(primary_key=True) class Laptop(InventoryItem): name = models.CharField(max_length=30) class Desktop(InventoryItem): name = models.CharField(max_length=30) This will make OneToOneFields from Laptop and Desktop ... | 2 | 1 |
77,346,557 | 2023-10-23 | https://stackoverflow.com/questions/77346557/read-row-for-given-id-from-pickle-file-without-loading-all-data | I have a dataframe with 2 columns (ID, Contents) which I am saving in pickle format. Say for example, I have 10 rows(ie 0 to 9 ID). I am trying to load a single row by passing ID (valid ID between 0-9) from the pickle file without loading the entire file. import pandas as pd import pickle id = 2 path = "contents.pickle... | Unfortunately I think pickle is not the right tool to do that (but maybe I'm wrong). Try a column-oriented data file format like parquet and pd.read_parquet: df.to_parquet('results.parquet') row = pd.read_parquet('results.parquet', filters=[('ID', '=', 9)]) Output: >>> row ID Contents 0 9 9 Update With pyarrow and Pa... | 2 | 3 |
77,346,244 | 2023-10-23 | https://stackoverflow.com/questions/77346244/how-to-resolve-incompatible-return-value-type-got-fancycat-expected-self | Here's a minimal example I've written: from __future__ import annotations from typing import Protocol from typing_extensions import Self class Cat(Protocol): def add(self, other: Self) -> Self: ... def sub(self, other: Self) -> Self: ... class FancyCat(Cat): def __init__(self, value: int): self._value = value def add(s... | Your code does not guarantee that Self will be returned. For example, child classes will still return FancyCat, therefore Self annotation is invalid. To get rid of errors, you can either: a) make sure it's always self.__class__ returned, which IS actual Self def add(self, other: Self) -> Self: return self.__class__(sel... | 4 | 4 |
77,338,439 | 2023-10-22 | https://stackoverflow.com/questions/77338439/is-there-a-difference-between-pyenv-activate-and-pyenv-local | I know that to activate a virtual environment with pyenv, we can run pyenv activate [virtualenv], but here, i also saw that we can "select" a virtual environment by running pyenv local [virtualenv]. So what is the difference between the two ways? | The base command is pyenv local <python_version>. It selects what Python version to use in the current directory or its subdirectories. pyenv activate <name> activates a Python virtual environment. pyenv local <venv-name> works after pyenv virtualenv venv-name and eval "$(pyenv virtualenv-init -)" in shell configuratio... | 3 | 3 |
77,343,330 | 2023-10-23 | https://stackoverflow.com/questions/77343330/customize-a-class-of-a-library | I am using a Python library that has one function that I would need to customize. That is not a problem, since I can make my own edited version like this: from coolLibrary import originalclass class myclass(originalclass): whatever... The problem that I am facing now, is that the library uses this originalclass in mul... | If coolLibrary.originalclass has explicit references to itself: # coolLibrary.py class originalclass: def foo(self): print('original foo') def bar(self): originalclass.foo(self) such that: # main.py import coolLibrary class myclass(coolLibrary.originalclass): def foo(self): print('custom foo') myclass().bar() outputs... | 2 | 2 |
77,342,884 | 2023-10-23 | https://stackoverflow.com/questions/77342884/need-to-reshape-transpose-dataframe-in-python | I have the following dataframe and I want to transpose it so that the elements in column "Trans_Type" become new columns to represent the values from column "Trans_amount". import pandas as pd import numpy as np df = pd.DataFrame([['21/10/2023','1','CR',2323], ['21/10/2023','1','CR',23], ['21/10/2023','1','DR',65], ['2... | You can use DataFrame.reset_index for helper column with unique values, so possible use DataFrame.pivot for reshape: out = (df.reset_index() .pivot(index=['index','Date','Account_Number'], columns='Trans_Type', values='Trns_Amount') .reset_index(level=[1,2])) print (out) Trans_Type Date Account_Number CR DR index 0 21/... | 2 | 2 |
77,342,104 | 2023-10-23 | https://stackoverflow.com/questions/77342104/scraping-addresses-tab-data-from-https-training-gov-au-organisation-details-90 | I am trying to scrape information from the "Addresses" tab on the webpage: https://training.gov.au/Organisation/Details/90003 using Python. However, I'm encountering an issue where, even after targeting the correct css selector, or tag, the code only returns null values. Strangely, it works correctly when I target the ... | The addresses you see on the page is loaded from external URL. You can use this example how to download the right HTML: import requests from bs4 import BeautifulSoup link = "https://training.gov.au/Organisation/Details/90003" response = requests.get(link) soup = BeautifulSoup(response.content, "html.parser") link = sou... | 2 | 1 |
77,341,139 | 2023-10-22 | https://stackoverflow.com/questions/77341139/python-loop-still-going | I am trying to write a program similar to a blind auction, but I am having issues with the while loop. I don't understand why the loop is not ending. I used Thonny and even after the player enters 'no', it seems like the loop is breaking since it prints what is outside the loop and then goes to the bid function inside ... | Don't use recursion as a substitute for looping. Put your while loop around all the code that asks for player names and bids. Your recursion is outside the while loop, so it occurs every time and you never get out of the loop. There's also no need for player_name and player_bid to be function parameters, since the func... | 2 | 1 |
77,340,804 | 2023-10-22 | https://stackoverflow.com/questions/77340804/crc-computation-port-from-c-to-python | I need to convert the following CRC computation algorithm to Python: #include <stdio.h> unsigned int Crc32Table[256]; unsigned int crc32jam(const unsigned char *Block, unsigned int uSize) { unsigned int x = -1; //initial value unsigned int c = 0; while (c < uSize) { x = ((x >> 8) ^ Crc32Table[((x ^ Block[c]) & 255)]); ... | Instead of porting your own CRC32 implementation, you can use one from the Python standard library. For historic reasons, the standard library includes two identical1 CRC32 implementations: binascii.crc32 zlib.crc32 Both implementations match the behavior of your crc32_1 function: import binascii import zlib >>> prin... | 2 | 3 |
77,339,578 | 2023-10-22 | https://stackoverflow.com/questions/77339578/only-1st-character-of-value-in-json-is-printing | import requests import json url = "https://betkarma.com/api/propsComparison?startDate=2023-10-17&endDate=2023-10-23&league=nfl" response = requests.get(url) data = response.json() print(response) for player_name in data["games"][0]["offers"][0]["player"]: if offers[0] == "player": value = player["value"] break print(p... | try this: import requests url = "https://betkarma.com/api/propsComparison?startDate=2023-10-17&endDate=2023-10-23&league=nfl" response = requests.get(url) data = response.json() for p in data.get("games")[0].get("offers"): print(p["player"]) output: Foye Oluokun Foye Oluokun Michael (Saints) Thomas Michael (Saints) Th... | 2 | 2 |
77,339,071 | 2023-10-22 | https://stackoverflow.com/questions/77339071/how-to-make-squiggly-lines-to-represent-unshown-parts-of-the-axis | I want to try to replicate the format of this chart form The Economist (the format, not necessarily the content). I've found a tutorial on how to do so here, which has the below code (dataset here) But it does not have the squiggly lines on the left of the axes that represent that part of the axis being skipped. impor... | You can tweak it manually : # I'm showing only the lines updated and/or added ax.set_xlim(-2, 25.05) ax.grid(which='major', axis='x', color='#758D99', alpha=0.6, zorder=1) ax.spines[['left', 'top','right', 'bottom']].set_visible(False) for y in ax.get_yticks(): ax.plot( [-2, -1.6, -1.4, -1.2, -1, ax.get_xticks()[:-1].m... | 2 | 1 |
77,335,813 | 2023-10-21 | https://stackoverflow.com/questions/77335813/iterating-over-rows-in-many-csv-files-and-modifying-them-in-pandas | I am writing a script that is supposed to read a lot of csv files and transform data in a specific column, when the condition is being met. To do this I have a for-loop that looks like this: for index, transformed_row in transformed_data.iterrows(): new_rows = [] if transformed_row['Code'] in ['14/9', '14+9', '149']: t... | I think the simpler and better performing option is to use Series.replace (link): replace_dict = {"14/9": "18", "14+9": "18", "149": "18", "3+4+1": "17"} transformed_data["Code"] = transformed_data["Code"].replace(replace_dict) | 2 | 1 |
77,337,481 | 2023-10-21 | https://stackoverflow.com/questions/77337481/merge-two-dataframes-with-partial-column-name-match | I want to merge/concatenate two dataframes tcia and clin. In contrast to the tcia dataframe, the clin dataframe has a substring at the end of the column names (i.e., the 3rd "-" followed by subsequent letters). The dataframes should be combined irrespective of the substring but the final dataframe should have this subs... | With df.set_axis method (to assign a new column index on-the-fly): df = pd.concat([clin.set_axis(clin.columns.str.rpartition('-', expand=False).str[0], axis=1), tcia]).set_axis(clin.columns, axis=1) print(df) TCGA-2K-A9WE-01 TCGA-2Z-A9J1-01 TCGA-2Z-A9J3-01 TCGA-2Z-A9J6-01 TCGA-2Z-A9J7-01 admin.batch_number 398.45.0 ... | 2 | 2 |
77,337,407 | 2023-10-21 | https://stackoverflow.com/questions/77337407/deploy-gen2-google-cloud-functions-with-github-actions | I was able to easily deploy to GitHub Actions for 1st generation Google Cloud Functions, but now with 2nd generation, I get authentication errors. How can I set up a GitHub workflow to deploy my function when I merge or push to my main branch? Here is the workflow I was using before - id: "deploy" uses: "google-github... | I got this working from a comment on this GitHub issue. Their comment is for a Node function. The code I offer below is for Python, but it's the same for all of them. You'll need a service account json key and the yaml that uses it - and that's it! Service Account Create a service account in the project via the GCP co... | 3 | 5 |
77,335,159 | 2023-10-21 | https://stackoverflow.com/questions/77335159/django-objects-filter-received-a-naive-datetime-while-time-zone-support-is-activ | So this question is specifically about querying a timezone aware date range with max min in Django 4.2. Timezone is set as TIME_ZONE = 'UTC' in settings.py and the model in question has two fields: open_to_readers = models.DateTimeField(auto_now=False, verbose_name="Campaign Opens") close_to_readers = models.DateTimeFi... | Likely the easiest way is just: from datetime import timedelta from django.utils.timezone import now date_min = now().replace(hour=0, minute=0, second=0, microsecond=0) date_max = date_min + timedelta(days=1) - date_min.resolution Campaigns.objects.filter( open_to_readers__lte=today_min, close_to_readers__gt=today_min ... | 2 | 1 |
77,333,861 | 2023-10-20 | https://stackoverflow.com/questions/77333861/have-read-html-read-cell-content-and-tooltip-text-bubble-separately-instead-o | This site page has tooltips appearing when hovering over values in columns "Score" and "XP LVL". It appears that read_html will concatenate cell content and tooltip. Splitting those in post-processing is not always obvious and I seek a way to have read_html handle them separately, possibly return them as two columns. T... | It turns out that this is because pandas uses the .text attribute of the <td> bs4.element.Tag objects and this one concatenate (without any separator) the texts of all the tag's children. In the first row of the table, the score has two children 6129 and Max 6129, thus the concat. <td nowrap="" class="barContainer"> <d... | 3 | 2 |
77,333,737 | 2023-10-20 | https://stackoverflow.com/questions/77333737/how-do-i-create-enums-in-python-3-11-with-no-arguments-passed-to-init | I have the following code, which works as expected on 3.9 and 3.10: from enum import Enum class Environment(Enum): DEV = () INT = () PROD = () def __init__(self): self._value_ = self.name.lower() def __str__(self): return self.name def get_url(self): if self is Environment.DEV: return 'http://localhost' else: return f'... | You could use auto() and _generate_next_value_: from enum import Enum, auto class Environment(Enum): def _generate_next_value_(name, start, count, last_values): return name DEV = auto() INT = auto() PROD = auto() This will automatically generate values based on the names. Note that while _generate_next_value_ is curre... | 2 | 2 |
77,333,397 | 2023-10-20 | https://stackoverflow.com/questions/77333397/how-do-you-merge-a-list-to-an-existing-dataframe | I am trying to replace a value in a pandas dataframe based on another column value. I made sample code below to replicate the issue, but essentially I want to add a column to an existing dataframe and then replace placeholder information based on another column's value. The dataframe I am using (not in the example) is ... | IMHO, the title makes your question an XY. I think you want to simply merge both objects : # sample_df["b"] = "" # no need for this line anymore out = sample_df.merge(pd.DataFrame(ex_list, columns=["a", "b"]), how="left") Output : print(out) a b 0 1 CHANGE 1 2 NaN 2 3 NaN 3 4 CHANGE 4 5 NaN | 3 | 3 |
77,333,168 | 2023-10-20 | https://stackoverflow.com/questions/77333168/invert-binary-numpy-array-using-a-mask | I have a binary N-by-N (N~=200) NumPy array populated with zeroes and ones. I would like to apply a Boolean mask and 'swap' the values that correspond to True in the mask, so for example if I had: arr = np.array([0,0,1,1], [0,0,1,1], [0,0,1,1], [0,0,1,1]) mask = np.array([True,False,True,False], [True,False,True,False]... | If you interpret the first (0,1) array as a boolean array, then you are doing the exclusive or operation of each entry in the first array with each entry of the second array. Therefore, you can do this with the numpy function np.logical_xor() as follows: arr = np.array([[0,0,1,1], [0,0,1,1], [0,0,1,1], [0,0,1,1]]) mask... | 2 | 3 |
77,331,248 | 2023-10-20 | https://stackoverflow.com/questions/77331248/azure-web-app-uses-azure-authentication-to-access-the-web-app-how-do-i-use-this | I am currently developing an Azure Web App with Python, it uses Azure AD Authentication for site access. I want to display the current users email (I plan to use this later for access tiers also). I saw a way to get the email through use of delegated GraphAPI to get the users details. I have attempted the way below: au... | The error occurred as your code use client credentials flow for generating access token to call /me endpoint, which is not a delegated flow as it does not involve user interaction. When I ran your code in my environment, I too got same error as below: import msal import requests authority = f'https://login.microsofto... | 2 | 3 |
77,330,978 | 2023-10-20 | https://stackoverflow.com/questions/77330978/alias-for-an-typable-union | I am looking for a way to create a type alias for a Union that is typeable. In my opinion, there is no suitable default type in the typing module. Typing.Iterable is an iterable, which could be a dict — but it shouldn't be. typing.Sequence is a sequence, which supports access by integer indices, but this doesn't inclu... | If I understand your question correctly you need a type alias which is generic over some type _T. If that's the case, for python>=3.10 you can make use of TypeAlias & TypeVar. from typing import TypeAlias, TypeVar _T = TypeVar("_T") ListOrTupleOrSetOrFrozenSet: TypeAlias = list[_T] | tuple[_T] | set[_T] | frozenset[_T]... | 3 | 4 |
77,328,739 | 2023-10-20 | https://stackoverflow.com/questions/77328739/subtraction-from-a-dictionary-of-dictionaries-in-a-pandas-dataframe | I have a dataframe where I want to find the difference in the unique_users for the latest day(2023-09-06) and previous day(2023-09-07) for a specific hour 2 and 13 separately for each key 'bsnl' and 'other' and for a specific Exception. I need to consider the Exception and Hour and Date to calculate the difference. Da... | You can slice and merge with help of json_normalize to rework the dictionaries to columns: date1 = pd.Timestamp('2023-09-07') date2 = pd.Timestamp('2023-09-06') hours = [2, 13] tmp = (df.join(pd.json_normalize(df['IMSI_Operator'])) .query('Hour in @hours') .set_index(['Date', 'Hour']) ) cols = list(tmp.filter(like='uni... | 3 | 2 |
77,322,485 | 2023-10-19 | https://stackoverflow.com/questions/77322485/how-to-pass-an-array-containing-functions-as-a-parameter-into-njit | I would like to pass an array which contains a list of numba compiled functions as a parameter into an njit method. In my attempt to do so, I encountered the following error: non-precise type array(pyobject, 1d, C). I'm able to pass a numba compiled function as parameter into an njit method, but i'm unable to do so if ... | You can try to pass variable number of arguments to function (but still, you get a warning message): import numba T = numba.float64( numba.float64, numba.float64, ) @numba.njit(T) def function1(x, y): return x > y @numba.njit(T) def function2(x, y): return x < y @numba.njit def main(*inputArray): print(inputArray[0](1.... | 2 | 3 |
77,327,162 | 2023-10-19 | https://stackoverflow.com/questions/77327162/list-the-differences-between-two-dataframe-columns-ignoring-case | I am trying to compare columns from 2 dataframes and return the difference, ignoring case. Here is what I have so far: import pandas as pd if __name__ == "__main__": data1={'Name':['Karan','Rohit','Sahil','Aryan']} data2={'Name':['karan','Rohit','Sahil']} df1=pd.DataFrame(data1) df2=pd.DataFrame(data2) print(list(set(d... | To perform a case insensitive comparison, use str.casefold: print(list(set(df1['Name'].str.casefold()).difference(df2['Name'].str.casefold()))) If you want to keep the original case use boolean indexing with isin: df1.loc[~df1['Name'].str.casefold().isin(df2['Name'].str.casefold()), 'Name'].unique() Output: array(['A... | 2 | 6 |
77,325,636 | 2023-10-19 | https://stackoverflow.com/questions/77325636/how-to-load-an-existing-vector-db-into-langchain | I have the following code which loads my pdf file generates embeddings and stores them in a vector db. I can then use it to preform searches on it. The issue is that every time i run it the embeddings are regrated and stored in the db along with the ones already created. Im trying to figurer out How to load an existing... | Your load_embeddings function is recreating the database every time you call it. Here's why: 1. You're loading from PyPDFLoader every time ... # We don't need this when loading from store loader = PyPDFLoader(file) ... 2. from_documents(documents, embedding, **kwargs) ... # We don't need to pass pages when loading fro... | 3 | 4 |
77,324,237 | 2023-10-19 | https://stackoverflow.com/questions/77324237/aligning-images-of-the-sun-but-theyre-drifting | I've been aligning over 200 images of the sun taken in sequence in order to analyse them at a later point. I thought I had managed, but when playing back a video of all the images in sequence I noticed that the sun drifts downwards. I believe this is because in some images the full disc is not present, and hence my ali... | Hope this helps you. I used the ideia presentend OpenCV: Fitting a single circle to an image (in Python). Also sorry for the huge answer. First lets create a larger canvas so we can centralize the sun image later. import cv2 as cv import matplotlib.pyplot as plt import numpy as np img1 = cv.imread('6cTxW.png') img2 = c... | 3 | 2 |
77,325,437 | 2023-10-19 | https://stackoverflow.com/questions/77325437/how-do-i-get-an-github-app-installation-token-to-authenticate-cloning-a-reposito | I am writing a Python application that needs to clone private repositories from an organization. I've already registered a GitHub App, and I can see in the documentation that this needs an installation access token, but each of the steps in how to get one of these takes me down a rabbit hole of (circular references of)... | There's a couple of steps needed for this: firstly you need to get some information from GitHub by hand, and then there is a little dance that your app needs to do to swap its authentication secrets for a temporary code that can be used to authenticate a git clone. Gather information Before you can write a function t... | 2 | 6 |
77,325,233 | 2023-10-19 | https://stackoverflow.com/questions/77325233/how-to-convert-a-dict-to-a-dataclass-reverse-of-asdict | the dataclasses module lets users make a dict from a dataclass reall conveniently, like this: from dataclasses import dataclass, asdict @dataclass class MyDataClass: ''' description of the dataclass ''' a: int b: int # create instance c = MyDataClass(100, 200) print(c) # turn into a dict d = asdict(c) print(d) But i a... | You can use make_dataclass: from dataclasses import make_dataclass my_dict = {"a": 100, "b": 200} make_dataclass( "MyDynamicallyCreatedDataclass", ((k, type(v)) for k, v in my_dict.items()) )(**my_dict) | 5 | 10 |
77,324,859 | 2023-10-19 | https://stackoverflow.com/questions/77324859/how-to-convert-list-of-tuple-into-a-string | I have a list of tuple and I'd like to convert the list into a string of tuple pair separted by comman. Not sure how to do it? For example if I have list of this a=[(830.0, 930.0), (940.0, 1040.0)] I'd like to convert it to a string like this b="(830.0, 930.0), (940.0, 1040.0)" a=[(830.0, 930.0), (940.0, 1040.0), (10... | Use f-strings or formatted string literals and str.strip: a = [(830.0, 930.0), (940.0, 1040.0)] b = f"{a}".strip("[]") print(b) # (830.0, 930.0), (940.0, 1040.0) | 3 | 3 |
77,321,575 | 2023-10-19 | https://stackoverflow.com/questions/77321575/how-to-set-scipy-interpolator-to-preserve-the-data-most-accurately | This is an (x,y) plot I have of a vehicle's position data every 0.1 seconds. The total set is around 500 points. I read other solutions about interpolating with SciPy (here and here), but it seems that SciPy interpolates at even intervals by default. Below is my current code: def reduce_dataset(x_list, y_list, num_int... | It seems to me that you are confused between the interpolator object that is constructed by interp1d, and the actual interpolated coordinates that are the final result you want. it seems that SciPy interpolates at even intervals by default interp1d returns an interpolator object that is built from the x and y coordin... | 2 | 3 |
77,323,830 | 2023-10-19 | https://stackoverflow.com/questions/77323830/why-is-this-python-priority-queue-failing-to-heapify | Why is this priority queue failing to heapify? Where (150, 200, 200) are the priority values assigned to the dictionaries import heapq priority_q = [ (150, {'intel-labels': {'timestamp': 150}}), (200, {'intel-labels': {'timestamp': 200}}), (200, {'intel-labels': {'timestamp': 200, 'xx': 'xx'}}) ] heapq.heapify(priority... | Why is this? heapq heapifies the heap according to comparisons. Tuples are compared lexicographically. If your first values in all tuples are distinct, you will never compare the second values. This is the case for your second example. If you have a duplicate value (200 in your first example), the second elements wil... | 3 | 4 |
77,321,812 | 2023-10-19 | https://stackoverflow.com/questions/77321812/threadpoolexecutor-exits-before-queue-is-empty | My goal is to concurrently crawl URLs from a queue. Based on the crawling result, the queue may be extended. Here is the MWE: import queue from concurrent.futures import ThreadPoolExecutor import time def get(url): # let's assume that the HTTP magic happens here time.sleep(1) return f'data from {url}' def crawl(url, ur... | You have a race condition where the check for more work to submit happens before new tasks are added from the other thread, you need to not exit the threadpool until you wait on all submitted jobs, and then check if there is more work to submit. task_queue = queue.Queue() with ThreadPoolExecutor(max_workers=8) as execu... | 4 | 1 |
77,316,817 | 2023-10-18 | https://stackoverflow.com/questions/77316817/python-sibling-relative-import-error-no-known-parent-package | I want to import a module from a subpackage so I went here Relative importing modules from parent folder subfolder and since it was not working I read all the literature here on stack and found a smaller problem that I can reproduce but cannot solve. I want to use relative imports because I don't wanna deal with sys.pa... | You should be running your project from the parent of project dir as: $ python -m project.main # note no .py This tells python that there is a package named project and inside it a module named main - then relative and absolute imports work correctly - once you change the import in main in either of from .bar import B... | 7 | 13 |
77,319,901 | 2023-10-18 | https://stackoverflow.com/questions/77319901/show-percentage-of-total-in-pandas-pivot-table-with-multiple-columns-based-on-si | Example dataframe, also available as a fiddle: import pandas as pd d = { "year": [2021, 2021, 2021, 2021, 2022, 2022, 2022, 2023, 2023, 2023, 2023], "type": ["A", "B", "B", "A", "A", "B", "A", "B", pd.NA, "B", "A"], "observation": [22, 11, 67, 44, 2, 16, 78, 9, 10, 11, 45] } df = pd.DataFrame(d) df_pivot = pd.pivot_tab... | Division should do it: df_pivot.div(df_pivot.sum(1),axis=0).round(2) type A B year 2021 0.50 0.50 2022 0.67 0.33 2023 0.33 0.67 | 4 | 4 |
77,319,069 | 2023-10-18 | https://stackoverflow.com/questions/77319069/why-does-assign-lambda-sometimes-reads-the-entire-column-rather-each-individua | I have a DataFrame with a code in a column. I want to extract the first digit from said code and add to a different column so I can use it to merge it with a different DF. My code is: df_a = df_a.assign(index_a = lambda x: int(str(x.code)[0])) When I use: df_a = df_a.assign(index_a = lambda x: x.code) This works and ... | it's so because str(x.code) convert the whole column each time, try this instead df_a['code'] = df_a['code'].apply(str) | 2 | 2 |
77,318,706 | 2023-10-18 | https://stackoverflow.com/questions/77318706/merging-multiple-files-with-unequal-rows-based-on-the-common-column-to-form-a-co | I have similar problem of merging-multiple-files-based-on-the-common-column as https://superuser.com/questions/1245094/merging-multiple-files-based-on-the-common-column. I am very near to the solution but I am new to python. I need help with the tweaking of code for joining multiple files. My IDs and columns for indivi... | Using any awk: $ cat tst.awk FNR == 1 { ++numCols } { if ( !($1 in ids2rows) ) { rows2ids[++numRows] = $1 ids2rows[$1] = numRows } rowNr = ids2rows[$1] vals[rowNr,numCols] = $2 } END { for ( rowNr=1; rowNr<=numRows; rowNr++ ) { id = rows2ids[rowNr] printf "%s", id for ( colNr=1; colNr<=numCols; colNr++ ) { val = ( (row... | 2 | 1 |
77,318,492 | 2023-10-18 | https://stackoverflow.com/questions/77318492/building-wheel-for-pyarrow-pyproject-toml-did-not-run-successfully | Just had IT install Python 3.12 on my Windows machine. I do not have admin rights on my machine, which may or may not be important. During install, the following were done: Clicked "Add Python 3.n to Path" box. Went into Customize installation and made sure pip was selected, and, selected "install for all users". I'm... | You are getting this error because pyarrow still does not support python 3.12. There are no wheels yet for 3.12 on pypi https://pypi.org/project/pyarrow/#files Here is the complete discussion : https://github.com/apache/arrow/issues/37880 A lot of packages are dependent on pyarraow. 3 weeks ago they posted: Due to the... | 4 | 6 |
77,317,554 | 2023-10-18 | https://stackoverflow.com/questions/77317554/merging-multiple-dataframes-together-with-pandas | I have multiple dataframes that are structured as follows: Molecule Name Molecular weight Score Population Score Population Error A 100 12 15 0.2 B 205 0.4 17 0.8 C 367 17 11 0.82 D 510 9 19.6 0.1 Molecule Name Molecular weight Score Population Score Population Error A 100 20 15 0.2 B 205 16 ... | You could use a custom concat with de-duplication of the Score columns and groupby.first to get the first molecule name: dfs = [df1, df2] # could be more than 2 input DataFrames out = (pd.concat([d.set_index(['Molecular weight', 'Population Score', 'Population Error']) .rename(columns={'Score': f'Score{i}'}) for i, d i... | 2 | 2 |
77,316,898 | 2023-10-18 | https://stackoverflow.com/questions/77316898/use-apply-function-in-all-columns-at-once-in-pandas | I have a panda database with several columns, I want to make two types of filters based on a list: 1 - Filter rows that contain at least one item in the list, regardless of the column 2 - Filter rows that contain all items in the row. For example, column 1 might contain one element, and column 2 might contain another e... | Since you want to match substrings, I would use a regex approach. Filter rows that contain at least one item in the list, regardless of the column Here we craft a regex, extract the substrings and keep the rows with at least a non-NA value import re target = ["Bonjour (coouse)", "La troisième voie"] pattern = '(%s)' % ... | 2 | 1 |
77,313,133 | 2023-10-18 | https://stackoverflow.com/questions/77313133/vs-code-sort-imports-command-has-disappeared-as-an-option-from-the-context-man | Why can I no longer sort my imports in VS Code. I have changed zero settings and sometimes it just does not appear. | They have recently changed this command to "Organize Imports" Comment that says it is ready for October update https://github.com/microsoft/vscode-python/issues/22147#issuecomment-1751173694 Comment that says the new command https://github.com/microsoft/vscode-python/issues/22147#issuecomment-1767140242 | 5 | 5 |
77,311,182 | 2023-10-17 | https://stackoverflow.com/questions/77311182/select-column-based-on-the-value-of-another-column-polars-python | I have a df with ten columns and another column with its values are partial name of the ten columns. Here is a similar sample: import polars as pl df = pl.DataFrame({ "ID" :["A" ,"B" ,"C" ] , "A Left" :["W1" ,"W2" ,"W3" ] , "A Right":["P1" ,"P2" ,"P3" ] , "B Left" :["G1" ,"G2" ,"G3" ] , "B Right":["Y1" ,"Y2" ,"Y3" ] , ... | It looks like you want to extract the "base" / "prefix" of the Left/Right columns? There are various ways you could do that: columns = pl.Series(df.select("^.+ (Left|Right)$").columns) columns = columns.str.extract(r"(.+) (Left|Right)$") shape: (3,) Series: '' [str] [ "A" "B" "C" ] You could then use pl.coalesce() to... | 3 | 1 |
77,308,101 | 2023-10-17 | https://stackoverflow.com/questions/77308101/when-plotting-with-sns-seaborn-it-just-shows-1-chunk-of-graph | What I want to achieve is something similar to this: This is the code I added: from pandas import * from matplotlib.pyplot import * from math import * import numpy as num import pandas as pd import matplotlib import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D %matplotlib inline import seaborn as s... | In this code, the issue is due to countplot() which may be related to the distribution of the data. Countplot() visualizes data by counting occurrences in each age group, so if some age groups have very few instances, they might not appear on the plot. To address this, you can arrange the age groups in ascending order ... | 2 | 2 |
77,274,665 | 2023-10-11 | https://stackoverflow.com/questions/77274665/cannot-debug-script-with-trio-asyncio-in-pycharm | I have this (very simplified) program running with trio as base async library and with trio_asyncio library allowing me to call asyncio methods too: import asyncio import trio import trio_asyncio async def async_main(*args): print('async_main start') async with trio_asyncio.open_loop() as loop: print('async_main before... | This helped me: open Actions search window (press shift twice and switch to Actions tab) type Registry, choose the Registry... item switch off (deselect) the python.debug.asyncio.repl property Thanks to Jetbrains support for help: PY-65970 | 3 | 8 |
77,279,039 | 2023-10-12 | https://stackoverflow.com/questions/77279039/vs-code-python-extension-v2023-18-0-stopped-resolving-all-python-imports-and-sor | My VS Code was working fine, I have a pyenv environment with a specific python version and installed dependencies which I was using and all was good and suddenly it stopped recognizing all imports. They are all whited out. Also I noticed that the Sort Imports option disappeared from the context menu options I have when... | These seem to be fresh issues coming from VSCode and Python extension for VSCode. After doing a lot of digging around I think both of these issues come from very recent changes from VSCode. I mean they were just released this month (October 2023). So regarding the Sort Imports option VSCode just stopped supporting it t... | 6 | 13 |
77,297,637 | 2023-10-15 | https://stackoverflow.com/questions/77297637/how-to-detect-barely-visible-lines-on-the-grayscale-image-and-calculate-their-le | I am trying to write computer vision code based on the OpenCV library in Python to detect horizontal lines with intensity close to background. See example of the image below. I have tried 2 approaches. The first one is based on Canny edge detection and Hough transform, but it detected only a few lines (see code and im... | I came up with the following solution based on image thresholding and contours detection. Combination of 2 additional filters gave more visible lines which was easier to detect using thresholding and contours detection. def getStreakyStructuresForOneImage(imagePath, showProcessingImages, filterVertical = False): scaleF... | 3 | 1 |
77,280,761 | 2023-10-12 | https://stackoverflow.com/questions/77280761/openai-api-error-module-openai-has-no-attribute-chatcompletion-did-you-me | I can't seem to figure out what the issue is here, I am running version 0.28.1: from what I have read I should be using ChatCompletion rather than Completion as that's what gpt-4 and 3.5-turbo supports. response = openai.ChatCompletion.create( prompt=question, temperature=0, max_tokens=3700, top_p=1, frequency_penalty... | First of all, be sure you have an up-to-date OpenAI package version. If not, upgrade the OpenAI package. Python: pip install --upgrade openai NodeJS: npm update openai The code posted in your question above has a mistake. The Chat Completions API doesn't have the prompt parameter as the Completions API does. Instead... | 2 | 3 |
77,273,461 | 2023-10-11 | https://stackoverflow.com/questions/77273461/error-could-not-build-wheels-for-fasttext-which-is-required-to-install-pyproje | I'm trying to install fasttext using pip install fasttext in python 3.11.4 but I'm running into trouble when building wheels. The error reads as follows: error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.37.32822\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 ... | Using pip install fasttext-wheel instead solved the problem for me. | 5 | 17 |
77,306,214 | 2023-10-17 | https://stackoverflow.com/questions/77306214/retaining-highlighted-text-in-an-image | I want to remove the non highlighted region (turn it white) from this image and just retain the highlighted portions. This is my image : Getting Highlighted Region import cv2 import numpy as np image = cv2.imread('0002.jpg') gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) lower_green = (30, 90, 90) upper_green = (100,... | I changed your code a little bit according to Christoph Rackwitz's comment. Here is the result import cv2 as cv import numpy as np image = cv.imread('Q0aCT.jpg', cv.IMREAD_COLOR) lower_green = (0, 100, 0) upper_green = (200, 255, 200) green_mask = cv.inRange(image, lower_green, upper_green) kernel = np.ones((5, 5), np.... | 2 | 3 |
77,310,400 | 2023-10-17 | https://stackoverflow.com/questions/77310400/join-polars-dataframes-with-varying-multiple-similar-columns | I am using the polars library in python and have two data frames the look like this import polars as pl data1 = { 'A': [1, 2, 3], 'B': [4, 5, 6], 'C': [7, 8, 9] } df1 = pl.DataFrame(data1) data2 = { 'B': [4, 5, 6], 'C': [7, 8, 9], 'D': [1, 2, 3] } df2 = pl.DataFrame(data2) # the column B and C are same in both data fra... | You can concat with how="align" but the resulting column order differs. pl.concat([df1, df2], how="align") shape: (3, 4) ┌─────┬─────┬─────┬─────┐ │ B ┆ C ┆ A ┆ D │ │ --- ┆ --- ┆ --- ┆ --- │ │ i64 ┆ i64 ┆ i64 ┆ i64 │ ╞═════╪═════╪═════╪═════╡ │ 4 ┆ 7 ┆ 1 ┆ 1 │ │ 5 ┆ 8 ┆ 2 ┆ 2 │ │ 6 ┆ 9 ┆ 3 ┆ 3 │ └─────┴─────┴─────┴───... | 3 | 3 |
77,311,656 | 2023-10-17 | https://stackoverflow.com/questions/77311656/access-parent-object-data-member-from-sub-object-in-python | I have a setup like the following class decorator: def __init__(self, fn): self.fn = fn @staticmethod def wrap(fn): return decorator(fn) def __call__(self): print(f"decorator {self} function called") class A: @decorator.wrap def foo(self): print(f"Object {self} called") def __init__(self): self.boo = 'Boo' How do I fr... | @S.B's solution works but is not thread-safe since multiple instances of A may be calling the foo method at about the same time in different threads, overriding the decorator object's instance attribute before a call to the __call__ method originated from another instance is made. A thread-safe approach would be to ret... | 2 | 2 |
77,312,659 | 2023-10-17 | https://stackoverflow.com/questions/77312659/plotting-timeseries-line-graph-for-unique-values-in-a-column | I am trying to plot a timeseries graph for all the unique keys in my dataset, below is my dataset, I have 7 unique keys and I am trying to plot event_date on x-axis and line graph for count on y axis. I am looping through each unique key and trying to plot date vs count however getting below error. Based on the error I... | The issue with the existing code is .count mirrors the pandas.Series.count method. You may not use . notation if the column name mirrors a pandas method. df[df.key == k]['count'] not df[df.key == k].count Additionally, using plt.plot will still cause issues, as seen in this plot. plt.plot also requires sorting x, a... | 2 | 1 |
77,284,039 | 2023-10-12 | https://stackoverflow.com/questions/77284039/how-to-properly-round-to-the-nearest-integer-in-double-double-arithmetic | I have to analyse a large amount of data using Python3 (PyPy implementation), where I do some operations on quite large floats, and must check if the results are close enough to integers. To exemplify, say I'm generating random pairs of numbers, and checking if they form pythagorean triples (are sides of right triangle... | Since Python integers have no upper limits, and you're looking for integral results, you should stick to integer inputs and integer operations. In your example, you can use math.isqrt to perform integer square root instead to avoid any imprecision of floating-point numbers altogether: results = [ (x, y) for x, y in gen... | 6 | 5 |
77,303,260 | 2023-10-16 | https://stackoverflow.com/questions/77303260/how-can-i-import-a-local-module-using-databricks-asset-bundles | I want to do something pretty simple here: import a module from the local filesystem using databricks asset bundles. These are the relevant files: databricks.yml bundle: name: my_bundle workspace: host: XXX targets: dev: mode: development default: true resources: jobs: my_job: name: my_job tasks: - task_key: my_task ex... | I recently ran into a similar issue, albeit with notebook tasks, and came to the following resolution, adapted to your example file structure: In your databricks.yml file, pass an argument to your script via parameters: databricks.yml resources: jobs: my_job: name: my_job tasks: - task_key: my_task existing_cluster_id... | 5 | 1 |
77,311,583 | 2023-10-17 | https://stackoverflow.com/questions/77311583/how-can-i-recursively-iterate-through-a-directory-in-python-while-ignoring-some | I have a directory structure on my filesystem, like this: folder_to_scan/ important_file_a important_file_b important_folder_a/ important_file_c important_folder_b/ important_file_d useless_folder/ ... I want to recursively scan through folder_to_scan/, and get all the file names. At the same time, I want to ignore us... | You can easily write your own file iterator using recursion. def useless(path): # your logic to discard folders goes here ... def my_files_iter(path): if path.is_file(): yield path elif path.is_dir(): if useless(path): return for child_path in path.iterdir(): yield from my_files_iter(child_path) | 2 | 2 |
77,309,717 | 2023-10-17 | https://stackoverflow.com/questions/77309717/version-controller-in-websocket-with-fastapi | So, I want to use router within the websocket call. This is what I have, at the moment (using dummy data) version->v1->init.py router.include_router(websocket_controller, prefix="/ws") router_without_prefix.include_router(websocket_controller) version->v1->websocket_controller.py So this is the enpoint: router = APIRo... | Edit: According to this FastAPI GitHub issue, this issue is specific to websocket routers. Including the router using include_router might not work, but adding routes individually works. Like so: app.add_websocket_route(path="/ws/something", route=websocket_endpoint) Old: Issue: The router has an extra prefix of /ws. ... | 2 | 3 |
77,306,748 | 2023-10-17 | https://stackoverflow.com/questions/77306748/how-is-qstyle-standardpixmap-defined-in-pyqt6 | How is the enumeration for QStyle.StandardPixmap defined in PyQt6? I've tried to replicate it as shown below: from enum import Enum class bootlegPixmap(Enum): SP_TitleBarMenuButton = 0 SP_TitleBarMinButton = 1 SP_TitleBarMaxButton = 2 for y in bootlegPixmap: print(y) I get the following output: bootlegPixmap.SP_TitleB... | This has got nothing to do with PyQt per se. It's just the normal behaviour of Python's enum classes. By default, the members of IntEnum/IntFlag print their numerical values; so if you want more informative output, you should use repr instead: >>> import enum >>> >>> class X(enum.IntEnum): A = 1 ... >>> f'{X.A} - {X.A!... | 2 | 3 |
77,307,742 | 2023-10-17 | https://stackoverflow.com/questions/77307742/how-should-i-pass-a-class-as-an-attribute-to-another-class-with-attrs | So, I just stumbled upon a hurdle concerning the use of attrs, which is quite new to me (I guess this also applies to dataclasses?). I have two classes, one I want to use as an attribute for another. This is how I would do this with regular classes: class Address: def __init__(self) -> None: self.street = None class Pe... | You can use the factory argument to specify a callable that is called to return a new instance for the field during instantiation: from attrs import define, field @define class Address: street: str | None = None @define class Person: name: str address: Address = field(factory=Address) | 2 | 4 |
77,304,167 | 2023-10-16 | https://stackoverflow.com/questions/77304167/using-pydantic-to-change-int-to-string | I am sometimes getting data that is either a string or int for 2 of my values. Im trying to figure out the best solution for handling this and I am using pydantic v2. Ive been studying the @field_validtaors(pre=True) but haven't been successful. Here's my code: class User(BaseModel): system_id: str db_id: str id: str r... | You can validate more than one fields in a field_validator. Try the following code: class User(BaseModel): system_id: str db_id: str id: str record: dict isValid: bool @field_validator("id","system_id", mode='before') def transform_id_to_str(cls, value) -> str: return str(value) u = User(system_id='199', db_id="1", id=... | 5 | 4 |
77,306,963 | 2023-10-17 | https://stackoverflow.com/questions/77306963/does-class-variable-is-common-among-objects-in-python | Suppose I want to implement common variable among objects using class variables (similar to static in java/c++). When I access class variable using object, it shows default value. Then I updaded class variable via object, its not updating class variable for other objects. It is showing old value in when class variable ... | You need to know the lookup procedure. First off, both instances and classes have their own namespaces. Only the class variables are shared between all instances. The namespace of classes and instances are accessible via __dict__ attribute. When you access an attribute from an instance, Python first looks at the namesp... | 3 | 3 |
77,306,397 | 2023-10-17 | https://stackoverflow.com/questions/77306397/wide-to-long-in-pandas-while-aligning-columns | Consider the following example: pd.DataFrame({'time' : [1,2,3], 'X1-Price': [10,12,11], 'X1-Quantity' : [2,3,4], 'X2-Price': [3,4,2], 'X2-Quantity' : [1,1,1]}) Out[92]: time X1-Price X1-Quantity X2-Price X2-Quantity 0 1 10 2 3 1 1 2 12 3 4 1 2 3 11 4 2 1 I am trying to reshape this wide dataframe into a long format. T... | wide_to_long requires a specific order. First invert the chunks around the -, then change some of the default parameters: # alternative: # tmp.columns = df.columns.str.split('-').str[::-1].str.join('-') tmp = df.rename(columns=lambda s: '-'.join(s.split('-')[::-1])) out = (pd.wide_to_long(tmp, i='time', j='type', stubn... | 2 | 3 |
77,305,599 | 2023-10-17 | https://stackoverflow.com/questions/77305599/how-do-i-get-pandas-to-ignore-at-start-of-header-line | I am reading a .fce file in Pandas. The start of the file looks like this: # Forces and moments acting on bodies # Direction1 = ( 1 0 0) # Direction2 = ( 0 1 0) # Moments around ( 0 0 0) # Boundary regions: 0 # Time F1-press F1-visc F1-total F2-press F2-visc F2-total M3-press M3-visc M3-total 1250 1.1630515 0.018437668... | Quick and easy option, shift your data after import: df = (pd.read_csv('DragLift.fce',sep='\s+', skiprows=5) .shift(axis=1).iloc[:, 1:] ) print(df) Alternatively, read the headers with a regex, ignore the lines with #, and pass the names manually: import re with open('DragLift.fce') as f: m = next(re.finditer('#([^\n]... | 2 | 2 |
77,304,052 | 2023-10-16 | https://stackoverflow.com/questions/77304052/transactional-operations-with-google-cloud-ndb | I am using Google Cloud Datastore via the python-ndb library (Python 3). My goal is to transactionally create two entities at once. For example, when a user creates an Account entity, also create a Profile entity, such that if either entity fails to be created, then neither entity should be created. From the datastore ... | You're almost there. It should be @ndb.transactional() def _transaction(): Ran your code and got your error. Then amended it to mine and it went through. Source - https://github.com/googleapis/python-ndb/blob/main/google/cloud/ndb/_transaction.py#L317 | 2 | 3 |
77,304,749 | 2023-10-16 | https://stackoverflow.com/questions/77304749/python-how-to-join-string-elements-in-list-with-complex-notation | Edited to show more accurate strings I have a long list with the following grouping structure. I am showing just two groups, but in reality there are 300. The strings can be any random collection of numbers and letters: ["['P431', 'N7260', 'K492'], ['R109', 'T075X9A'], ['U8154', 'C861']", "['R878X8', 'T61'], ['F6332', ... | You can try this: from ast import literal_eval example=[ "['P431', 'N7260', 'K492'], ['R109', 'T075X9A'], ['U8154', 'C861']", "['R878X8', 'T61'], ['F6332', 'Q7979'], ['L520'], ['B7939', 'K5132']", "['a','b','c'], 'not a list'" ] for st in example: *first_grp,last=literal_eval(st) if any(not isinstance(s, list) for s in... | 3 | 2 |
77,304,625 | 2023-10-16 | https://stackoverflow.com/questions/77304625/gunicorn3-goes-to-the-development-server | When I open a server with gunicorn for my flask app, it automatically opens the development server of flask, without giving me any errors: $ gunicorn3 --workers=1 main:app \[2023-10-16 19:46:13 +0000\] \[1061\] \[INFO\] Starting gunicorn 20.1.0 \[2023-10-16 19:46:13 +0000\] \[1061\] \[INFO\] Listening at: http://127.0.... | If you have the following lines in your main application script then it will cause Flask's development server to start if __name__ == '__main__': app.run() You could comment out the above part Make sure that you don't have any environment variables like FLASK_ENV=development or FLASK_APP=app.py Confirm that main:app ... | 2 | 2 |
77,302,486 | 2023-10-16 | https://stackoverflow.com/questions/77302486/sort-values-in-a-nested-dictionary-from-min-to-max | I created a dictionary, named dict_dif and loaded nested data into the same. The nested structure of this dictionary has the following structure: Variables (four different variables) Regions (eleven different regions for each of the four variables) Data points (60 data points per region). The dictionary looks as foll... | If I understand correctly, you want to sort the numeric values for each variable sorted_dict = { variable: {region: sorted(values) for region, values in regions.items()} for variable, regions in dict_dif.items() } | 2 | 2 |
77,277,096 | 2023-10-12 | https://stackoverflow.com/questions/77277096/error-in-calculating-dynamic-time-warping | I am using this github codes (https://github.com/nageshsinghc4/-Dynamic-Time-Warping-DTW-/blob/main/Dynamic_Time_Warping(DTW).ipynb) to calculate Dynamic Time Warping. However, when run dtw_distance, warp_path = fastdtw(x, y, dist=euclidean), I get an error that "ValueError: Input vector should be 1-D.". I have same pr... | There's a conflict here between what SciPy is expecting and what FastDTW is expecting. FastDTW is expecting to compare one element at a time. SciPy is expecting to get an entire vector at once. Here's what FastDTW says about the dist argument. (Source.) dist : function or int The method for calculating the distance be... | 2 | 3 |
77,295,731 | 2023-10-15 | https://stackoverflow.com/questions/77295731/postgresql-values-list-table-constructor-with-sqlalchemy-how-to-for-native-sq | I am trying to use PostgreSQL Values list https://www.postgresql.org/docs/current/queries-values.html (also known as table constructor) in Python with SQLAlchemy. Here the SQL working in PostgreSQL SELECT input_values.ticker FROM (VALUES ('A'), ('B'), ('C')) as input_values(ticker) I built a list of tickers and passin... | For the general case, the Table Value Constructor (TVC) values should be a list of tuples, not a list of scalar values tickers = [('A',), ('B',), ('C',)] from which we can then build the TVC (VALUES construct) tvc = values( column("ticker", String), name="input_values" ).data(tickers) Now the easiest way to get the q... | 2 | 2 |
77,297,624 | 2023-10-15 | https://stackoverflow.com/questions/77297624/writing-gzip-csv-file-introduces-random-chars-in-the-first-row | I am writing some csv data to a csv gzip file in python as follows import csv import gzip import io csv_rows=[["cara","vera","tara"],["rar","mar","bar"],["jump","lump","dump"]] mem_file = io.BytesIO() with gzip.GzipFile(fileobj=mem_file,mode="wb") as gz: with io.TextIOWrapper(gz, encoding='utf-8') as wrapper: writer = ... | Remove this line: gz.write(mem_file.getvalue()) (also it isgetvalue(), not getValue()). The csv.writer() already uses io.TextIOWrapper to write to gzip.GzipFile, so there's no need to write to it again. | 2 | 3 |
77,269,618 | 2023-10-11 | https://stackoverflow.com/questions/77269618/why-does-an-operation-on-a-large-integer-silently-overflow | I have a list that contains very large integers and I want to cast it into a pandas column with a specific dtype. As an example, if the list contains 2**31, which is outside the limit of int32 dtype, casting it into dtype int32 throws an Overflow Error, which lets me know to use another dtype or handle the number in so... | Why does an operation on a large integer silently overflow? As a short answer, that's because of how numpy deals with overflows. On my platform (with the same versions of Python/Packages as yours) : from platform import * import numpy as np; import pandas as pd system(), version(), machine() python_version(), pd.__v... | 8 | 9 |
77,294,679 | 2023-10-14 | https://stackoverflow.com/questions/77294679/pandas-column-split-a-row-with-conditional-and-create-a-separate-column | It seems the problem is not difficult, but somehow I am not able to make it work. My problem is as follows. I have a dataframe say as follows: dfin A B C a 1 198q24 a 2 128q6 a 6 1456 b 7 67q22 b 1 56 c 3 451q2 d 11 1q789 So now what I want to do is as follows, whenever the script will encounter a 'q', it will split ... | import pandas as pd def get_input() -> pd.DataFrame: csv_text = """ a 1 198q24 a 2 128q6 a 6 1456 b 7 67q22 b 1 56 c 3 451q2 d 11 1q789 """.strip() return pd.DataFrame(map(str.split, csv_text.splitlines()), columns=["a", "b", "c"]) def split_on_q(df_in: pd.DataFrame) -> pd.DataFrame: df = df_in.c.str.split("q", expand=... | 2 | 1 |
77,281,898 | 2023-10-12 | https://stackoverflow.com/questions/77281898/pandas-dataframe-columns-unexpectedly-out-of-order | I encountered a rather unexpected result today with a pandas dataframe. My script takes genome sequence data (in fasta format) as input and calculates several basic metrics. I store those metrics in a pandas dataframe. The script starts by defining an empty dataframe with headers: stats_df = pd.DataFrame(columns=['Asse... | I think the problem is that for new_df_row you're using a dictionary to create the data frame. Dictionaries are unordered (in Python 3.6 and below), so the keys do not have any fix order. This article and also this question explain the issue nicely. To fix it, you could upgrade to Python 3.7 which has ordered dictionar... | 2 | 2 |
77,294,331 | 2023-10-14 | https://stackoverflow.com/questions/77294331/how-to-relay-the-sum-of-each-nested-list-to-the-next-one | My input is this list : my_list = [[3, 4, -1], [0, 1], [-2], [7, 5, 8]] I need to sum the nested list i and pad it to the right of the list i+1, it's like a relay course. I have to mention that the original list should be untouched and I'm not allowed to copy it. wanted = [[3, 4, -1], [0, 1, 6], [-2, 7], [7, 5, 8, 5]]... | You can try itertools.accumulate: from itertools import accumulate my_list = [[3, 4, -1], [0, 1], [-2], [7, 5, 8]] print(list(accumulate(my_list, lambda l1, l2: [*l2, sum(l1)]))) Prints: [[3, 4, -1], [0, 1, 6], [-2, 7], [7, 5, 8, 5]] EDIT: As @KellyBundy pointed in the comments, the first element in the list is shar... | 5 | 5 |
77,294,480 | 2023-10-14 | https://stackoverflow.com/questions/77294480/how-to-take-the-number-of-occurrences-of-a-number-in-a-list-and-create-a-new-lis | I am given a list to put into a function. The function is then suppose to return the amount of times each number was in the function. So for example, if the given list is [15,15,15,6,6,6,7,7], the output list should be [3,15,3,6,2,7]. def encode_rle(flat_data): set_list = set(flat_data) flat_data_converted = [] for val... | def encode_rle(flat_data): result = [] i = 0 n = len(flat_data) while i < n: count = 1 while i + 1 < n and flat_data[i] == flat_data[i + 1]: count += 1 i += 1 result.extend([count, flat_data[i]]) i += 1 return result flat_data = [15,15,15,6,6,6,7,7] print(flat_data) print(encode_rle(flat_data)) Expected output: [3, 15... | 2 | 1 |
77,293,906 | 2023-10-14 | https://stackoverflow.com/questions/77293906/error-botocore-exceptions-httpclienterror-an-http-client-raised-an-unhandled-e | So I am pretty new to asynchronous programming in python3. I am creating aws sqs client using types_aiobotocore_sqs and aiobotocore libraries. But I am getting the error mentioned in the title. Following is the code implementation url.py file: @api_view(["GET"]) def root_view(request): async def run_async(): sqs_helper... | When you use async with session.create_client(...) as client, the client object is limited to that context and will be None outside of it. You should assign it directly instead to ensure it's accessible outside that context: async def create_sqs_client(self): session = get_session() client = await session.create_client... | 2 | 3 |
77,292,600 | 2023-10-14 | https://stackoverflow.com/questions/77292600/how-to-automatically-delete-row-after-10-minutes-after-creation | Suppose I create a database and add desired tables, columns with this code: import sqlite3 connection = sqlite3.connect("clients.db", check_same_thread=False) cursor = connection.cursor() cursor.execute("CREATE TABLE IF NOT EXISTS customers(user_id INT, user_name, dt_string)") cursor.execute("""INSERT INTO customers VA... | Understand that sqlite is serverless. That is its whole purpose. So there is nothing doing anything fancy in the background. It is not like SQL servers, that may have some procedures and stuff that could implement this kind of temporality (I am not aware of anything like that in MySql neither. But, I am not well versed... | 3 | 2 |
77,287,622 | 2023-10-13 | https://stackoverflow.com/questions/77287622/modulenotfounderror-no-module-named-kafka-vendor-six-moves-in-dockerized-djan | I am facing an issue with my Dockerized Django application. I am using the following Dockerfile to build my application: FROM python:alpine ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 ENV DJANGO_SUPERUSER_PASSWORD datahub RUN mkdir app WORKDIR /app COPY ./app . RUN mkdir -p volumes RUN apk update RUN apk add -... | This appears to be a Python 3.12 issue, I have the same error but in an entirely different context. Instead of FROM python:alpine I suggest you use FROM python:3.11 3.12 is still very new are there are many projects still trying to work out issues. | 15 | 14 |
77,291,235 | 2023-10-14 | https://stackoverflow.com/questions/77291235/python-object-cannot-access-bases-attribute | An class instance should have access to the classes attributes. __bases__ as per my understand is a class attribute If I have a class called C1, I can call C1.__bases__ but if I define an instance of C1, obj1 = C1(), obj1.__bases__ does not work? I am surprised because using attribute notation, it should start a search... | Standard attribute lookup searches through an object's __dict__ and those of its class and its class's ancestors. A class's __bases__ attribute isn't defined in its __dict__. __bases__ is managed by a descriptor in type.__dict__, which handles the attribute lookup by retrieving the tuple from an internal field in the c... | 2 | 4 |
77,290,205 | 2023-10-13 | https://stackoverflow.com/questions/77290205/python-in-memory-gzip-on-existing-file | I have a situation where I have an existing file. I want to compress this file using gzip and get the base64 encoding of this file and use this string for latter operations including sending as part of data in an API call. I have the following code which works fine: import base64 import gzip base64_string_to_use_later ... | Use gzip.compress() to compress the data in memory instead of writing to a file. import base64 import gzip with open('C:\\test.json', 'rb') as orig_file: base64_string_to_use_later = base64.b64encode(gzip.compress(orig_file.read())) | 2 | 2 |
77,286,930 | 2023-10-13 | https://stackoverflow.com/questions/77286930/np-select-int64-and-int64-difference | def apply_km_cluster(df): conditions = [ (df['value'].between(0, 20000)), # Between 0 and 20,000 (df['value'].between(20000, 50000)), # Between 20,000 and 50,000 (df['value'].between(50000, 100000)), # Between 50,000 and 100,000 (df['value'].between(100000, 200000)), # Between 100,000 and 200,000 (df['value'] >= 200000... | np.select has a test # If cond array is not an ndarray in boolean format or scalar bool, abort. for i, cond in enumerate(condlist): if cond.dtype.type is not np.bool_: raise TypeError( 'invalid entry {} in condlist: should be boolean ndarray'.format(i)) If df is a dataframe with Int64 dtype: In [316]: df.info() <class... | 2 | 1 |
77,284,818 | 2023-10-13 | https://stackoverflow.com/questions/77284818/should-hypen-minus-u002d-or-hypen-u2010-be-used-for-iso-8601-datetimes | Python interpreter gives the following when generating an ISO-8601 formatted date/time string: >>> import datetime >>> datetime.datetime.now().isoformat(timespec='seconds') '2023-10-12T22:35:02' Note that the '-' character in the string is a hypen-minus character. When going backwards to produce the datetime object, w... | The ISO 8601 standard is not publicly available for free. Perhaps someone who has a copy can post a more definitive answer. ISO has published a brief summary of the ISO 8601 standard. The summary consistently uses HYPHEN-MINUS (0x2D). (Thanks to Giacomo Catenazzi for pointing this out in a comment.) RFC 3339 is based o... | 2 | 5 |
77,279,451 | 2023-10-12 | https://stackoverflow.com/questions/77279451/draw-a-star-with-turtle-in-python | Initially, I needed to draw flowers using stars with a random number of branches. So, I wrote this function: def star(nb_branches:int , size:int) : for i in range(int(nb_branches / 2)) : forward(size * 3) left(180 - (360 / nb_branches)) (the arguments of this function are random and are created in another function but... | I was thinking about the differentiation between the odd and even numbers when I realized that my initial code worked well with even numbers, but with the half of branches. So, I took your function for the odd numbered stars and I intentionally doubled the number of branches for the even numbered stars to achieve it. F... | 2 | 1 |
77,287,959 | 2023-10-13 | https://stackoverflow.com/questions/77287959/if-a-row-contains-at-least-two-not-nan-values-split-the-row-into-two-separate-o | I am trying to convert datafarame to desired output format with requirements mentioned below. Provided requirements: Each row can only keep one not Nan value (except Trh1 and Trh2) I want to avoid methods that iterate over each row for performance reasons. I have only included four columns, for example, in a real sce... | handling a jump cols = ['Index', 'Schema', 'Column', 'Trh1', 'Trh2'] special = ['Trh1', 'Trh2'] others = list(df.columns.difference(cols)) out = (df .assign(init=lambda d: d[others].isna().all(axis=1)) [cols+['init']+others] .set_index(cols).stack().to_frame() .assign(n=lambda d: d.groupby(level=range(df.index.ndim)).c... | 6 | 6 |
77,286,483 | 2023-10-13 | https://stackoverflow.com/questions/77286483/maturin-project-with-python-bindings-behind-feature | I'm trying to write optional Python bindings for a Rust library, using maturin and PyO3. The default layout created by maturin is my-project ├── Cargo.toml ├── python │ └── my_project │ ├── __init__.py │ └── bar.py ├── pyproject.toml ├── README.md └── src └── lib.rs where all Rust code, including the #[pymodule] attri... | You are almost there. You need to add following section to the Cargo.toml to remove the warning. [features] default = ["python"] python = [] Quoting from the documentation: Features are defined in the [features] table in Cargo.toml. Each feature specifies an array of other features or optional dependencies that it en... | 4 | 2 |
77,283,252 | 2023-10-12 | https://stackoverflow.com/questions/77283252/how-to-get-a-surface-plot-to-sync-with-the-associated-scatter-points | I have a simple problem, wherein I have a training set of 80 points and a testing set of 20 points, which I am plotting against their corresponding values of bearing stress on the z axis, where the x axis is thickness and y axis is diameter of a component I am optimizing. I get the response as I want it, but it looks l... | The artifact you have is due to misordered points in your meshgrid. Once you have regressed your parameters, it does not matter which points (independent variables) you use to plot (train or test, or something else), they will be part of the same surface. So, it is sufficient to plot the surface with an ad hoc grid (re... | 2 | 2 |
77,276,769 | 2023-10-11 | https://stackoverflow.com/questions/77276769/using-the-unittest-module-in-python-to-write-non-unit-tests-is-it-bad-practice | Suppose I design a class, called A, in its own module. Consider an abbreviation of what the code might look like. # file: A.py class A: # define some useful behaviour for A class pass Then I go on to perform some unit tests for this new class. The tests would be roughly be carried out as shown below. The reason for de... | On my opinion you're still in the realm of unit tests, but I have a suggestion for you. The hint Insert instances of the class A as arguments of the __init__() method of class bundle_A. Following this hint I have modified your file A_bundle.py as following: class A_bundle: def __init__(self, a1, a2): self.a1 = a1 sel... | 4 | 2 |
77,283,648 | 2023-10-12 | https://stackoverflow.com/questions/77283648/vs-code-python-extension-circa-v2018-19-no-longer-includes-support-for-linters | The Python extension for VS Code used to provide builtin support for tools like formatters and linters, including: Linting: Pylint, Flake8, Mypy, Bandit, Pydocstyle, Pycodestyle, Prospector, Pylama Formatting: autopep8, Black, YAPF What's happening to the builtin support for these tools in the Python extension? How c... | Basically, see https://github.com/microsoft/vscode-python/wiki/Migration-to-Python-Tools-Extensions. I'll try to summarize/quote. As announced on April 2022, our team has been working towards breaking the tools support we offer in the Python extension for Visual Studio Code into separate extensions, with the intent of... | 10 | 17 |
77,276,144 | 2023-10-11 | https://stackoverflow.com/questions/77276144/extract-consecutive-rows-with-similar-values-in-a-column-more-with-a-specific-pa | I was looking out to extract consecutive rows with specified text repeated continuously for more than 5 times. ex: A B C 10 john 1 12 paul 1 23 kishan 1 12 teja 1 12 zebo 1 324 vauh -1 3434 krish -1 232 poo -1 4535 zoo 1 4343 doo 1 342 foo -1 123 soo 1 121 koo -1 34 loo -1 343454 moo -1 565343 noo -1 2323234 voo -1 34... | Using masks and factorize: # identify 1s m = df['C'].eq(1) # group consecutive values g = m.ne(m.shift()).cumsum() # identify stretches of 5+ 1s m2 = m & df.groupby(g)['C'].transform('size').ge(5) out = (df.loc[m2] .assign(group=pd.factorize(g[m2])[0]+1) ) Output: A B C group 0 10 john 1 1 1 12 paul 1 1 2 23 kishan 1... | 2 | 4 |
77,281,875 | 2023-10-12 | https://stackoverflow.com/questions/77281875/add-new-row-with-differ-of-last-and-first-row | I would like to create a summary row to show differ between last and first row. e.g. import pandas as pd data = [ ['A',1,5], ['B',2,4], ['C',3,3], ['D',4,2], ['E',5,1], ['F',6,0] ] df = pd.DataFrame(data,columns=['name','x','y']) print(df) Output ddataframe should be: : name x y : 0 A 1 5 : 1 B 2 4 : 2 C 3 3 : 3 D 4 2... | Subtract first row from last row and concat the diff along index axis c = ['x', 'y'] diff = df[c].iloc[-1] - df[c].iloc[0] diff['name'] = 'diff' pd.concat([df, diff.to_frame().T], ignore_index=True) name x y 0 A 1 5 1 B 2 4 2 C 3 3 3 D 4 2 4 E 5 1 5 F 6 0 6 diff 5 -5 | 2 | 2 |
77,277,139 | 2023-10-12 | https://stackoverflow.com/questions/77277139/install-python-3-12-using-mamba-on-mac | I am trying to install python 3.12 on an M1 Apple Mac using mamba as follows ... mamba install -c conda-forge python=3.12.0 It yields the following error message ... Looking for: ['python=3.12.0'] conda-forge/osx-arm64 Using cache conda-forge/noarch Using cache Could not solve for environment specs The following pack... | Upgrading base environment Python to a version that hasn't finished migrating1 is a recipe for trouble. Generally, one does not need to upgrade base environment's Python unless the Python version goes EOL. If you would like to explore the new Python 3.12, then create a new environment: mamba create -n py312 -c conda-fo... | 2 | 7 |
77,274,572 | 2023-10-11 | https://stackoverflow.com/questions/77274572/multiqc-modulenotfounderror-no-module-named-imp | I am running fastqc and multiqc in ubuntu linux terminal. fastqc runs perfectly without any issues but multiqc fails to run, showing the message. No idea how to fix the missing 'imp' module. I tried to read and apply every solution found in the internet or google. I used the command 'conda install multiqc' to install ... | Python 3.12 is new and the consequences of the changes it introduces (like dropping the imp module) need to propagate to the community. Stay on Python 3.11 for now. | 25 | 48 |
77,280,579 | 2023-10-12 | https://stackoverflow.com/questions/77280579/pandas-vectorised-way-to-forward-fill-a-series-using-a-gradient | Consider a dataframe which has a series price with gaps containing NaN: import numpy as np import pandas as pd df = pd.DataFrame({"price": [1, 2, 3, np.nan, np.nan, np.nan, np.nan, np.nan, 9, 10]}, index=pd.date_range("2023-01-01", periods=10)) price 2023-01-01 1.0 2023-01-02 2.0 2023-01-03 3.0 2023-01-04 NaN 2023-01... | Assuming you want to use the last diff as a step size to increment the NaNs, you could compute the diff, ffill it, then use that to fillna the original Series, finally compute a groupby.cumsum: m = df['price'].notna() df['gradient_fill'] = (df['price'].fillna(df['price'].diff().ffill()) .groupby(m.cumsum()).cumsum() ) ... | 3 | 2 |
77,280,167 | 2023-10-12 | https://stackoverflow.com/questions/77280167/replacing-einsum-with-normal-operations | I need to replace einsum operation with standard numpy operations in the following code: import numpy as np a = np.random.rand(128, 16, 8, 32) b = np.random.rand(256, 8, 32) output = np.einsum('aijb,rjb->ira', a, b) How would I do that? | One option would be to align to a similar shape and broadcast multiply, then sum and reorder the axes: output2 = (b[None, None]*a[:,:,None]).sum(axis=(-1, -2)).transpose((1, 2, 0)) # assert np.allclose(output, output2) But this is much less efficient as it's producing a large intermediate (shape (128, 16, 256, 8, 32))... | 2 | 5 |
77,272,655 | 2023-10-11 | https://stackoverflow.com/questions/77272655/why-is-a-lambdef-allowed-as-a-type-hint-for-variables | The Python grammar has this rule: assignment: | NAME ':' expression ['=' annotated_rhs ] # other options for rule omitted while the expression rules permit a lambda definition (lambdef). That means this python syntax is valid: q: lambda p: p * 4 = 1 Is there a use case for permitting a lambda there, or is this just a... | This is specified under the PEP-0526(Syntax for Variable Annotations). Python does not care about the annotation as long as “it evaluates without raising”. It's the duty of the type-checker to flag it as invalid annotation. Quoting from the PEP: Other uses of annotations While Python with this PEP will not object to: ... | 2 | 2 |
77,275,464 | 2023-10-11 | https://stackoverflow.com/questions/77275464/iterative-search-on-secondary-dataframe-to-return-values-to-primary-dataframe-n | I have two dataframes - df1 & df2. I need to search each value from a specific column in df1 on df2 and return 2 nearest values. data1 = np.array([(1, 150), (2, 250), (3, 350), (4, 590)]) df1 = pd.DataFrame(data1, columns=['n', 'day']) df1 n day 0 1 150 1 2 250 2 3 350 3 4 590 data2 = np.array([(120, 10.5), (180, 10.7... | Another possible solution : N = 2 day1 = df1["day"].to_numpy()[:, None] day2 = df2["day"].to_numpy(); arr2 = df2.to_numpy() idx = np.sort(np.argsort(np.abs(day2 - day1), axis=1)[:, :N]) days = pd.DataFrame(arr2[:, 0][idx], columns=["day1", "day2"]) rates = pd.DataFrame(arr2[:, 1][idx], columns=["rate1", "rate2"]) out =... | 5 | 6 |
77,275,476 | 2023-10-11 | https://stackoverflow.com/questions/77275476/do-numpy-savez-and-numpy-savez-compressed-use-pickle | I recently encountered numpy.savez and numpy.savez_compressed. Both seem to work well with arrays of differing types, including object arrays. However, numpy.load does not work well with object type arrays. For example: import numpy as np numbers = np.full((10, 1), np.pi) strings = np.full((10, 1), "letters", dtype=obj... | Since you have dtype=object for that, pickle will be used (serializing Python objects). Serializing with pickle is allowed by default when saving, but deserializing pickles must be explicitly requested when loading. That's because loading pickled data can execute arbitrary code, and for untrusted input this would be a ... | 2 | 2 |
77,275,400 | 2023-10-11 | https://stackoverflow.com/questions/77275400/create-a-typing-annotated-instance-with-variadic-args-in-older-python | The question is simply how to reproduce this: import typing a = [1, 2, 3] cls = typing.Annotated[int, *a] or even this: import typing cls1 = typing.Annotated[int, 1, 2, 3] unann_cls = typing.get_args(cls1)[0] metadata = cls1.__metadata__ cls2 = typing.Annotated[unann_cls, *metadata] in Python 3.9-3.10. Annotated[int,... | In the expression obj[1, 2, 3] 1, 2, 3 is just a tuple literal. It's exactly the same as x = 1, 2, 3 obj[x] We're simply passing the tuple (1, 2, 3) to __getitem__. To get the behavior you want, you can wrap the tuple literal with parentheses so that the syntax for sequence unpacking inside a tuple literal kicks in: ... | 2 | 2 |
77,272,373 | 2023-10-11 | https://stackoverflow.com/questions/77272373/repeat-each-item-in-a-list-based-on-condition-in-a-df-column | I have a pandas data frame, and a list. The pandas data frame has 2 columns State and dates. State Dates 0 1/1/2023 1 2/1/2023 2 3/1/2023 3 4/1/2023 0 1/1/2023 1 2/1/2023 0 1/1/2023 1 2/1/2023 2 3/1/2023 0 1/1/2023 1 2/1/2023 2 3/1/2023 3 4/1/2023 4 5/1/2023 5 6/1/2023 ... country = [A, B, C, D,...] Every time State i... | Another solution: country = ["A", "B", "C", "D"] df["Country"] = df.groupby(df["State"].eq(0).cumsum())["State"].transform( lambda _, i=iter(country): next(i, None) ) print(df) Prints: State Dates Country 0 0 1/1/2023 A 1 1 2/1/2023 A 2 2 3/1/2023 A 3 3 4/1/2023 A 4 0 1/1/2023 B 5 1 2/1/2023 B 6 0 1/1/2023 C 7 1 2/1/... | 3 | 1 |
77,270,468 | 2023-10-11 | https://stackoverflow.com/questions/77270468/looking-for-a-py2neo-fork | Unfortunately due to some internal politics within neo4j, the py2neo project is now EOL and was deleted from pypi. See this twitter thread. Is there anyone who might have forked the GitHub repository? | You can see updates here https://community.neo4j.com/t/farewell-py2neo-what-happens-now/64419 Copied from Above link, https://github.com/overhangio/py2neo, https://github.com/SarLecobee/py2neo, https://github.com/neo4j-field/py2neo, And One can see here as well, https://www.reddit.com/r/Neo4j/comments/174jl66/py2neo_... | 2 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.