Category "python-3.x"

pyserial response unicodeDecodeError

import serial s = serial.Serial(port = 'Com3', 9600, timeout = 2) data = s.readline().decode().rstrip("\r\n") So basically when I try to read the data I get t

Two nodes less than 1 mile apart on the same road fail to work in osmnx.shortest_path_length

I have successfully used osmnx.shortest_path_length to calculate many distances but these two nodes return : NetworkXNoPath: Node 9473072437 not reachable from

How to find and replace a part of a value in json file

I have a json file that I am using as a Dictionary in python. The json file is really long with 10k+ records. I need to replace the $home part in the "iscatego

Zybooks 6.18 LAB: Track laps to miles

So I have written the code correctly for this problem, but I don't understand a part of the code that was already present as a requirement to use. What does thi

Problems when installing python3-dev

This problem has been torturing me for 2 days, and without python3-dev I can't pip install any module, can someone tell how could I solve this? The following

pywintypes.com_error: (-2147352567,'Exception occured.', (0, None, None, None, 0, -2147352566)

Background: I am using xlwings to open an xlsx file and use a list (tuple) to receive all the data of the table. The code is as follows. def get_excel_al

Pyttsx3 cutting out some speech?

So I'm using the pyttsx3 method to convert some text into a file. My code is as such text = open('script.txt','r').read() engine = pyttsx3.init() engine.save_t

Force password authentication (ignore keys in .ssh folder) in Paramiko in Python

I'm trying to write a small Python program to check whether an SSH server allows a password authentication. Here is the current plan: import base64 import para

PyQt5: How to set SameSite/Secure headers in QNetworkCookie

I have some Python code which sets a cookie like this: loader = QtWebEngineWidgets.QWebEngineView() profile = QtWebEngineWidgets.QWebEngineProfile("storage", lo

What determines the item order when converting a set to a list?

I know there are several similar questions, but I haven't found one yet that talks about what I would like to know. If this is a duplicate, please point it out.

returning results from python script to variable in Jupyter notebook

I have a python script that returns a pandas dataframe and I want to run the script in a Jupyter notebook and then save the results to a variable. The data are

Quick way to visualise multiple columns in Altair with regression lines

So the way I have been visualising multiple columns quickly in Altair is to use repeat. This method is ok until I want to add regression lines using transform_r

pynag with python3.6 TypeError

I'm trying to read my nagios config data as follows: pynag.Model.cfg_file = "path_to_nagios.cfg" all_hosts = pynag.Model.Host.objects.all" This returns an erro

How can I connect to the google search ads 360 api via a python script?

I have to build a data pipeline which downloads reports from google search ads 360, processes them and saves them in google big query. Because we're planning on

Using tf.data.Dataset as training input to Keras model NOT working

I have a simple code, which DOES work, for training a Keras model in Tensorflow using numpy arrays as features and labels. If I then wrap these numpy arrays usi

Run keras.Models.fit() in graph

How to run keras.model.fit() in graph not with eager execution...?? I tried to run my model in graph by using tf.compat.v1.disable_eager_execution(), but the c

Python : how to solve "The requested URL was rejected. Please consult with your administrator."

I had the following problem : There is a bunch of .csv files I have to download from a web site, about 100 of them. Downloading each one requires 3-4 clicks an

How to make attribute in dataclass read-only?

Let's say I have a class like this: class C: def __init__(self, stuff: int): self._stuff = stuff @property def stuff(self) -> int:

AttributeError: module 'torch' has no attribute 'rfft' with PyTorch

I am getting an error using a code that should work according to the documentation. The goal is to calculate the Feature Similarity Index Measure (FSIM) using t

Can we append a dataframe to snowflake table having some data, when some columns are same and some columns are different?

I have a dataframe which contains some columns and snowflake table is having some columns. Some columns are same and some columns are different between them. As