Category "python"

changing dtype in polars

i created a data frame using polars. when datas are inserted, dtype of the coulmn automatically changes to what inserted. (i think its a feature of polars?) but

Scrapy doesnt save data [closed]

I am just learning web scraping and using ScrapiApi for proxy, I followed tutorial here, but not able to save any results Here is the output f

I want to make separated file for telegram bot every commands in python

pytelegrambotapii am making a telegram bot and i want to make every command in separated files i tried to do with this code from run_start import * @bot.message

snakemake warning that code used to generate one or several output files has changed, but they haven't

I'm running into an issue where when I dry-run (or run for real) a rule I get this message... The code used to generate one or several output files has changed:

Get previous values when solving an ODE in Gekko

I'm trying to solve a DAE in Gekko, where some of the components will depend upon the solution to a convolution integral This requires a constant dt, but I'm s

Tensorflow Keras: Dimension/Shape Error when running model.fit

I am trying to use Tensorflow and Keras for a prediction model. I first read in my dataset that has shape (7709, 58), then normalize it: normalizer = tf.keras.l

How I can write an objective function >1 summations in Pyomo

I am trying to model a MILP objective to minimize the total cost. The total cost is a combination of the following variables.[Objective Function Screenshot][1]

ModuleNotFoundError: No module named 'qdarkstyle.colorsystem' in Ubuntu Spyder 5.3.0

I have recently installed Ubuntu to try out its usage and efficiency with Spyder. Currently, after using pip to install the latest version of Spyder(5.3.0), I g

Migrate a "zmq_send" command to Python

I have a c function that publish data to a c++ subscriber, now I want to migrate this c function to Python: void setup_msg_publish() { int r; zmqcontext

How do I retrieve data from my JSON file uploaded on Heroku (discord.py) [duplicate]

I am only using JSON file for database in discord.py. The problem is, when I am deploying new update to my bot, my old JSON data is overwritte

How to create a dual-stack (v4+v6) python UDP server?

By searching for 'python dual-stack', I found https://bugs.python.org/issue25667 where someone mentions that this was already resolved in https://bugs.python.or

Fill in uneven sized lists in Python

I have a 2D-List contains unequal size lengths, like this: lst = [[1,2,3],[-1,2,4],[0,2],[2,-3,6]] I use this code to insert a 0 if element size less 3: newlis

python stream file : no idea why this doesnt work ( but i have same stream id every time )

PS : (due to my country's teaching program, I need to write python code like this ) Hello, I have no idea why this doesn't work: from pickle import load,dump

Making multiple "any" more efficient

I am using any to see if a string in a longer string (description) matches with any strings across several lists. I have the code working, but I feel like it's

ValueError: Cannot feed value of shape (1, 256, 256) for Tensor 'input_x:0', which has shape '(?, 256, 256, 3)'

Code: from deeplab_v3 import Deeplab_v3 ### from data_utils import DataSet ########## import cv2 import os # import tensorflow as tf

How to import data with dates as index from excel with pandas

I am importing the data with this command df = pd.read_excel('C:/Users/Me/Data.xlsx', sheet_name='Prices') and this is the result: The date is a common column

Reverse sort order for part of a key

I need to sort a list of objects. Currently I am doing it like this: mylist = [aobject, bobject, cobject] mylist.sort(key=mykey) def mykey(sortelem): attrib

How do I create a while-loop in python with showing a random object from my list? [duplicate]

So I have the following task: First generate a list with strings of fictitious names for image files (e.g.my_list['image1.png','image2.png','i

Unnest json dict to rows in pandas

I have the following dataset from a json file: mydf = pd.DataFrame({ 'load': { 0: {'id': '100','name': 'Joe'}, 1: {'id': '101','name': 'Ann'}, 2: {'id': '1

How to locate print output? or convert it into jpeg?

I'm trying to show more than one dataframe with using tkinter. There are 2 options for me, showing dataframe directly by using print() and saving dataframe as j