Category "python-3.x"

Cannot import functions in from one directory's subfolder to other pyhton files in same parent directories sub folders. How do I use init.py files

parent_folder / subfolder1 / subsubfolder1/ a.py b.py subsubfolder2/ c.py d.py e.py subfolder2 / subsubfolder2/ f.py g.py subfolder3 / h.py i.py g.py I want to

Python function to iterate each unique column and transform using pyspark

I'm building the following global function in Pyspark to go through each column in my CSV that is in different formats and convert them all to one unique format

Why does column + column concatenation create arrays for some Windows accounts?

When running the below Python code, I get different results depending on the user account/admin privileges that is used. The code is saved as test.py on a Windo

SettingWithCopyWarning Python3

I am finding the max of df2 by row, and setting the max value to new col on df1. df1['max'] = df2[df2.keys().tolist()].max(axis=1) This line is throwing a Sett

find files with similar ID from different folder

I have two folder A and B. in each folder I have text files containing participant IDs starting from 100. some files can be present in both folders. i want to c

AttributeError: 'tuple' object has no attribute 'read' music21 .show()

i have been trying to show a score converted from krn file import music21 as m import os test_data = "D:/Programming/DATA - SCIENCE/deep learning/music gener

Cannot assign "<Invoive: Project>": "Invoive.user" must be a "InvoiveCompany" instance

New in Python code stuffs need a help, Invoices = Parent, Items = Child, I need to add This child items in parent, If i directly save this with the code be

How can I change the color of certain characters using tkinter in python?

I'm coding a brainfuck compiler and im having trouble updating the text color, as I want different symbols to have a different color depending on what they are.

Python Rolling sum for 32 bit vs 64 bit

I am getting strange results when doing rollingSum for 64 bit vs 32 bit precision. Please see the code for display 1 vs 2. Display 1 shows the right rolling sum

F5 SDK - SSL Insecure request

Is there a way to ignore SSL? I'm running Python 3.10.1 code: from f5sdk.bigip import ManagementClient device = ManagementClient('10.10.17.127', user='admin',

How to use a variable/function from a class instance in a differrent class with kivy?

first, I'm new here, so don't hesitate to correct me if I act innapropriatly ! I'm making a sudo turn based RPG combat to train with kivy tools and I've come in

Django customUser models

I have faced two or three issues with django customuser model. The first one being the skills models. I wanted to add the Skills in the custom user, realized th

Python: round(random.uniform) printing wrong float value on output console but in background its correct value

See the following code import re import random s = "~|21|050000|voltage|current|ApparentPower|12345~" for _ in range(100): vol_val = round(random.uniform(23

Python argparse unexpected behavior when passing "``" to the argument string in pysaprk cluster mode

I am trying to pass a string in my pyspark code and it works fine but when i pass the following string to escape reserved keyword `date` or any value passed in

communicating with serial virtual COM port using python

I have written snippet below to communicate (send a simple '1' character) with serial virtual COM3 port, which is connected to a STM32 board, using python. But

from django.core.management import execute_from_command_line not working

I am working on a bug project. Which is on Python 2.7, we are migrating to Python 3.9. I am getting import errors in manage.py during importfrom django.core.man

Insert a png image in a matplotlib figure

I'm trying to insert a png image in matplotlib figure (ref) import matplotlib.pyplot as plt import numpy as np from matplotlib.figure import Figure from matplo

How to write .xlsx data to a .txt file ensuring each column has its own text file, then each row is a new line?

I believe I am close to cracking this however I can't add multiple lines of text to the .txt files. The column do relate to their own .txt files. import openpyx

What is the difference between these two codes? (Python: circular singly linked list)

These are the codes for __iter__ method of a circular singly linked list. But I don't understand the difference between the two. def __iter__(self): node =

What is the difference between these two codes? (Python: circular singly linked list)

These are the codes for __iter__ method of a circular singly linked list. But I don't understand the difference between the two. def __iter__(self): node =