Quantcast
Browsing all 14069 articles
Browse latest View live

Pydantic Generic Basemodel Validation Error

Pydantic Generic BaseModels fails unexpectedly when validating python instances but succeeds when validating the same data as a dictionary.Python: 3.11.8Pydantic: 2.7.1Here is the Generic Model:from...

View Article


Image may be NSFW.
Clik here to view.

How to set xlim when save some frames to file by matplotlib in python?

I use python and matplotlib to create bar chart race animation, the data is time series and keep update every day. I want only save updated frames to file, for example, the frames are 10460 unti...

View Article


Pandas: multiindex group

i have the following data:import pandas as pd, numpy as npdata = [['id', 'date', 'b_field', 'a_field'], ['XYX', '01/01/2024', 100, 101], ['XYX', '01/02/2024', 200, 201], ['ABC', '01/01/2024', 300,...

View Article

SQLAlchemy filter on Query again got extra junk rows

I have Django experience. Now I would like to try some DIY python packages to my mini project. I Here is my code.models.pyimport enumfrom datetime import date, datetimefrom sqlalchemy import...

View Article

Why can't I get error when I want to open my colab link?

I edited a file on Colab about a month ago and only saved the link for myself. Now, when I try to access it, I get this error: Request had invalid authentication credentials. Expected OAuth 2 access...

View Article


How to insert an attribute and value 'true' to a record and false to...

I have list of tables class1, class2, class3...Each has multiple records like department, student, subjects etc.Student records have attributes USN, branch, age, DOB, phoneNo, isLeader,...

View Article

Image may be NSFW.
Clik here to view.

I can't import TinyMCE

No matter what I did, I couldn't import Tinyemc. I don't just get this error on Tinyemc; This problem exists in everything that is similar.I couldn't find a solution to the problem in any way.

View Article

Image may be NSFW.
Clik here to view.

Improving Text Alignment in OCR-Extracted Text Using pytesseract

I'm facing issues with misaligned text extraction from images. I suspect the problem lies in formatting rather than extraction. Can I utilize bounding box coordinates to improve text alignment?see this...

View Article


Cannot get Discord OAuth to work on website in Flask

I posted something earlier that at least gave me a direction, but I am stuck again. I want to use the Discord API as a login for my website, then later (after someone fills out a form), take that...

View Article


Type-hinting code to retrieve values of a typing.Literal behind a TypeDefAlias

Consider the following code, written for Python 3.12 (leveraging PEP-695):import typingtype Animal = typing.Literal["dog", "cat"]def enum_values(t: typing.TypeAliasType) -> typing.Sequence[str]:...

View Article

matplotlib not displaying image on Jupyter Notebook

I am using ubuntu 14.04 and coding in jupyter notebook using anaconda2.7 and everything else is up to date . Today I was coding, every thing worked fine. I closed the notebook and when I reopened it,...

View Article

Image may be NSFW.
Clik here to view.

Draw error shading bands on line plot - python

Let's say I have 25 lines like this: x = np.linspace(0, 30, 60)y = np.sin(x/6*np.pi)error = np.random.normal(0.1, 0.02, size=y.shape)y1 = y+ np.random.normal(0, 0.1, size=y.shape)y2= y+...

View Article

How to make a stacked Sankey diagram? [closed]

I am trying to replicate the graph for my export-by-country data which extends over several years.Is it possible to do using Python?I have found a similar question related to R. I am wondering if any...

View Article


How to fetch all the API urls from django project in Python?

I have a django project, where some API URLs are present in urls.py in urlpatterns path and some are registered as routers(rest_framework_extensions.routers).ref:# urls.pyurlpatterns = [...

View Article

Python, Pygame, VScode, FileNotFoundError: No file 'Snake/img/end.jpg',...

I'm new couple weeks, anyways, I have made a couple games, Flappy Bird, Snake, Sudoku, and with these I had main menu screens, Game over screens, Lose Screens, then suddenly when I try to go to code...

View Article


dmc card responsivity - plotly dash

I've got multiple dmc.card items within a dash app layout. I've got them set to a specific height and width. I've also instilled base, sm, md, lg values to account for a responsive change in screen...

View Article

python to read a Bazel file and form unified string in loop

Team,I have this Bazel file that I want to read in python and form a stringoutput should be string like this arm_base: artifactory.build.team.com/docker/ast/arm should be combination of $registry and...

View Article


how to know what commands running in background on windows?

I accidentally opened a word document with malware and I need to know what commands it run in background when it opened. Quite while ago, I saw someone using python script to show background commands...

View Article

How do I clean html code with multiple unwanted newlines using Python?

I have a lot of html pages that have somehow become embedded with multiple newline characters, with the tags on separate lines and some of the sentences split up at apparently random intervals. Here is...

View Article

Boost Python C++ boost::python::list input Python argument types did not...

Created a test function to test if Boost Python can pass a Python list to a C++ method. However, it results in the following error:Boost.Python.ArgumentError: Python argument types in...

View Article
Browsing all 14069 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>