Category "python-3.x"

python - remove space in the end of range loop (int)

Its quite simple but I got stuck. I have two files who need to be identical(even spaces) file #1 is the output from : for i in range(0, 19): print(i)

Python write dictionary to csv with header

I want to write a specific python dictionary to csv with header. I have looked at other questions but none of them have the similar dictionary structure as mine

Joining voice call without joining group using telethon, pytgcalls

Is it possible to join a voice call in a group, without joining the group? In Telegram client you can do it, but I couldn't figure out how to do it using teleth

win32com.client to format an Excel columns

I am writing output data to excel using pandas. I want to format excel using win32com.client as I do not easier method for this. my code is from some internet

Tensorflow not found. pip 21.3.1, Python 3.8.9

I am trying to install TF but pip is failing to find any of it's versions. pip install tensorflow returns ERROR: Could not find a version that satisfies the req

Python Real and imaginary : How to print -2-2i

Can you please help me with the below code where I am not getting the desired result: class comp: def __init__(self, real, imag): self.real=real

How to convert list of Hex values into Ascii string in python?

I have a list of Hex value variables in my python code. I need to convert into ASCII string. Can someone please suggest to me, how to convert it? HexList = [

How to fix this code to calculate correct costs in Python?

Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, a

change seaborn scatter plot legend from number to text

Here is how I plot the decision boundary of my SVC` classifier. X, y = make_classification(n_samples=100, n_features=2, n_redundant=0, n_clusters_per_class=

How can i get the the two nodes (coordinates) between a edge? In OSMNX if i had (u,v,x) by ox.distance.nearest_edges

I have the id's of an edge and I want to get the coordinates(x,y) of the nodes inside it, I try this way: #this is my graph: G = ox.graph_from_address('Arequipa

Logging error in Python 3.x : TypeError: a bytes-like object is required, not 'str'

I am on Python 3.6.5. While using logging I am getting the following error - "TypeError: a bytes-like object is required, not 'str'" It worked fine in Python

Module pyfiglet not found

The code : import pyfiglet print(dir(pyfiglet)) The error : ModuleNotFoundError: No module named 'pyfiglet' Even though I downloaded "pip 21.0.1" and importe

python failing __eq__ test

I'm new to python and I'm learning to use pytest. I have a class defined as: class Matrix: def __init__(self, *rows): row_length = len(rows[0])

how to write select- where- query in big table using python client module

New to big table, was able to inset data in bigtable using python ,, tried the snippet below to read rows for specific condition but it is returning all the r

Python venv not creating virtual environment

I'm trying to create a virtual environment for my current Django project using python3 -m venv env however the command doesn't create any directory with bin/

I am not able to import module from S3 in glue job

I have a Python file in my S3 bucket s3://pymod_import_testing/hello_world.py and I have a glue-job with the following special-parameters configured --extra-py-

How to print all the unique combinations of a list?

list_a = [1, 2, 3] I want to print all the unique combinations from the list like this [ [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3] ] Note: Without usin

Dash | TypeError: render_default_labels() takes 9 positional arguments but 10 were given

Goal: Find function call and amend parameters passed. Traceback: Traceback (most recent call last): File "/home/me/miniconda3/envs/project/lib/python3.9/site-

How to save a seaborn plot as svg or png

Hi all I have been trying to save my output chart with plt.savefig("coeff.png") as svg or png but what I get is only a blank picture. Is there anyway I could ge

How to fix the NumPy .dtype 'NoneType' error

I am running the following Python code in PyCharm debug mode. import numpy as np, pandas as pd, numpy.polynomial.chebyshev as chebyshev from pathlib import Path