Category "python"

sqlalchemy return constant dict in select

I am using sqlalchemy with MySql. I need to return a dict in select. Adding that dict value to fetched data is not an option. Is there any way in sqlalchemy or

how to convert lmd file to csv? [Flow Cytometry data]

lmd file extension is often used for generating flow cytometry data. But this couldn't be directly used for processing either in R or Python. Is there a way to

How do I change this recursive approach to iterative approach?

This is a game function from pygame. If user press left (pygame.KEYDOWN.K_LEFT), angle -= 1. Else if user press right (pygame.KEYDOWN.K_RIGHT), angle += 1. 'Eve

How do I import flask while using pipenv, I am running into a 'module not found' error

I have installed flask using pipenv but when trying to import, I'm running into an error yet the import is listed in the Pipfile. What might be the issue?

Django Stripping Blanks In Between Words When Generating Blanks

I am working on a Hangman game using Django and I'm having some trouble generating the blanks from the words if the answer is two words, such as a first and las

What is the problem in this keras input shape?

from matplotlib import units import numpy as np from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from tensorflow.keras

How to compare 2 two-dimensional lists in python according to a given condition?

This function compares 2 matrices element by element, compares according to the principle that the corresponding elements should have the same parity def equals

How do I set up visdom on a remote server (HPC3, using a SLURM script)?

I am trying to visualise different loss function plots during training using Visdom. I am using a HPC3 system which makes use of a SLURM script and command line

How to catch exception clickhouse_driver dbapi?

I want to catch exception while executing scipts/connecting to base using clickhouse_driver-drive dbapi. Can I catch errors codes and errors message like errorc

Python: Transform ISIN, WKN or RIC to Yahoo Ticker Symbol?

Based on this post here, I have the possibility to transform the ISIN to some form ticker symbol with help of library investpy. This transformation is correct f

DiscordPy Bot abnormally long shutdown times

So here's the crux of the problem. I'm using the Discord Py API (1.7.3). I have 2 bots I run that use it, Red Bot and the one I made myself. I've come to notice

Matplotlib - pyplot is overwriting the backend agg config

I need to change the default matplotlib backend from agg to TkAgg. I have added the line backend: TkAgg to my matplotlibrc file located at ~/.config/matplotlib/

How to save the Pandas dataframe from pd.crosstab as a figure (with render_mpl_table)?

I'm trying to save output from crosstab as an image. I found a great solution here How to save the Pandas dataframe/series data as a figure?. However, I am not

How to combine multi excel workbook into single workbook with multiple worksheets

I have 3 workboooks with single sheets.I need to combine all workbooks into single workbook with 3 sheets. I tried the below code : from pandas import ExcelWrit

The Pygame image is not loading up correctly [duplicate]

I am writing a game in PyGame. But when I want to load images, the background image is not loading up correctly. Also, no error message is sho

Mplstereonet azimuth labels

For my thesis I use the mplstereonet package to plot stereographic projections of points and planes obtained by using the ObsPy package. For my application I wa

Webrtc on Python failing to change ICE connection state between peers

First, I want to mention that I am very new to WebRTC, so any advice would be very helpful. Currently I am using aiortc library to build my own WebRTC app. Here

Extracting specific number of rows from dataframe

I have a csv file having two columns i.e. imagename and ID. There are multiple image names for same ID as shown in picture. Number of image names against id is

OSError: [Errno 63] File name too long while calling python subprocess

While running the following code I'm getting file name too long import subprocess import json data = [{ "id": 1, "first_name": "Janet", "last_name": "Til

Forbidden (403) CSRF verification failed. Request aborted. Reason given for failure: Origin checking failed does not match any trusted origins

Help Reason given for failure: Origin checking failed - https://praktikum6.jhoncena.repl.co does not match any trusted origins. In general, this can occur when