Category "python"

How to read Panasonic .raw files?

I have several .raw file but I am not able to open them on my computer (Mac OS) or in a Jupyter Notebook with Python. I tried to download the module rawpy with

Problems converting a list comprehension

This list comprehension works, but I’d rather have it written like conventional loops: Here is the list comprehension: with open(sys.argv[1], 'r') as f:

How can I go about averaging different sized images?

I have a collection of images from tissue sections which contain a specific area of interest. Given this is biology, each image is slightly different (position

How do I fix pyqt web browser not loading pages

I am trying to make a web browser using pyqt, but every time I click a url it just does not do anything, that or it crashes. For example if I try to open wikipe

How can I add a conditional within my model that changes a model field based on a previous fields value?

Using Django/python. So I have a 'food' model that is taking multiple user inputs, one of which is 'type' and has the options of 'fresh' and 'pantry'. Another i

Cannot create leases container (Gremlin API) with /id as partition key, but comos db trigger requires /id as partition key

I am trying to create a cosmos db trigger for Gremlin API, since the trigger requires partition key as /id, I am not able to create it either from settings in t

How is data transferred between two Python scripts

as an example I have two scripts, say script1.py f = open("output1.txt", "w") count = 1 for i in range(100): f.write(str(count) + "\n

How to make a random sample of panel data (keeping all years for each randomly selected id)

I am using an unbalanced panel dataset, with multiple ids, each with 1 or more years of data. I would like to work with a smaller dataset as I build my code. I

How to plot nodes of different shapes and facecolor of bbox in the same graph using networkx and matplotlib in Python?

I want to plot a simple graph using networkx. There are two nodes with labels Python and Programming in each. The code and graph are as follows: import networkx

Add string and integer from one line string generate by speech recognizer to 2 separate list

I have some string from speech recognizer and the value is random but in the same form (x,y...n) MyOrder = 'orange 2 grape 3 apple 4 mango 5 banana 1' How to a

How to search JSON array in MySQL using sqlalchemy?

I have one JSON column in my table. I want to filter by this column using sqlalchemy with Python and MySQL. I've tried in this way, but unsuccessfully. My colum

How to create object having read-only attributes dynamically

I want to create object which is having read-only attributes. And it need to be initialize dynamically. Here is situation I want. readOnlyObject = ReadOnlyClass

Interactive Manhattan plot with string chromosome names

I'm trying to generate ManhattanPlot using Dash-plotly library for python: https://dash.plotly.com/dash-bio/manhattanplot I have SNP results data for plants lik

Assigning each excel sheet to a variable while looping (using openpyxl) and create dataframe of each sheets

I have an excel document with multiple sheets containing different data sets. For instance, first sheet has 2 column data where as the second sheet (sheet 2) ha

Django notification

How to display notification before two days from start date and display notfication on end date using django? from django.shortcuts import render from app.model

How align content in every cell to center?

I'm trying to center the table content using df.style.set_properties(**{'text-align': 'center'}). But I couldn't do it. Is there any other way? Here is the full

How to integrate Azure text to speech with streamlit?

I am trying to integrate azure text to speech with streamlit. import azure.cognitiveservices.speech as speechsdk import streamlit as st st.title("Let's learn M

Drawing lines in a Tic-Tac-Toe in PyQt5

I have a tic-tac-toe game (made by me) , and is working fine . However , I want to draw lines on the buttons when someone wins the game (For example , if I win

How do I match variations of a pandas string based on a list?

I have a pandas dataframe with one column containing country names and I'd like to flag them if they appear in a list of countries I have. However, some of the

How to reset Apache airflow dag cache in the backfill?

I started a backfill job in airflow and ran into an issue with the dag definition half way through the backfill. The code changed required a tiny tweak to an ex