Category "python"

Is it possible to persist .env values in the .whl files when installed on a Databricks cluster? I'd prefer to keep all values in library (.whl)

I have created a project in Pycharm. This project has a .py file with functions, init.py and a .env file with my secret values. I need to be able to run this in

Using forloop.counter to iterate over list in django template

I have a list of objects named chargers_list and on my view I estimate when will the charging be done. List of estimates is the same size and is named eta. I it

How to calculate the path of a particle subject to a vortex?

I'm trying to draw a path of a particle starting at (x0,y0) subject to a vortex located at (xv,yv). This is inspired by Lorena Barba's AeroPython. As stated in

how to create a dataframe from a list of dictionary value?

I have a list - elements_listed = [{'data': {'data/2022/04/1': '26-Apr-2022 07:47', 'data/2022/04/2': '24-Apr-2022 17:27', 'data/2022/04/3': '22-Apr-2022 14:20'

In a pyspark dataframe, when I rename a column, the previous name can still be used for filtering. Bug or feature?

I work on DataBricks with PySpark dataframe containing string-type columns. I use .withColumnRenamed() to rename one of them. Later in the process I use a .filt

Assign multiple columns different values based on conditions in Panda dataframe

I have dataframe where new columns need to be added based on existing column values conditions and I am looking for an efficient way of doing. For Ex: df = pd.D

Creating & publishing datasource in Tableau directly from Redshift

Is it possible to create & publish redshift table directly to Tableau server as a datasource using python? It'll be basically select * from table. I looked

python dbf - add row of dict to existing file

I have a dbf file with following structure... FieldnameList(['ORDNUMB C(10) SYSTEM', 'SIDE C(1) BINARY SYSTEM', 'POSITION C(3)', 'COMPTYPE C(2)', 'COMPCODE C(6)

Using Type Hints with Brackets [duplicate]

After several hours of chasing this error with an AWS Elastic Beanstalk app (Python 3.8), I learned that I can't use type hints with brackets,

Python subprocess.Popen unable to parse argument

Trying to use Popen to launch multiple processes in separate shells, the process is an .exe file that takes arguments, when passing these arguments in a for loo

Looping through each row in array to calculate cosine similarity

I have a subset of a dataframe that looks like: <OUT> PageNumber english_only_tags 175 flower architecture people 162 hair red bobbles

Import issues in Visual Studio Code

I am trying to execute this code in Visual Studio Code, the code works, my problem is related to the import of numpy; the other imports are working. import code

gem5 build fails with " Embedded python library 3.6 or newer required, found 2.7.17."

I cannot build gem5, when I build gem5,the terminal shows " Embedded python library 3.6 or newer required, found 2.7.17.".However,when I check my python version

How to use QTest.keySequence?

I'm trying to test if a shortcut is working using PyQt5 and QTest. Here is my code: Main.py from PyQt5.QtGui import QKeySequence from PyQt5.QtWidgets import QWi

How to build an .aab using Buildozer via Docker?

I have just seen that support for AAB files have just been introduced in Python for Android (p4a). Considering that, fom August 2021, new apps are required to p

unhashable type 'list' when i enter on change_list in Django

I search for days for a solution for this problem. after touching the admin.py file to override the get_queryset and get_form methods I ran into the unhashable

Finding and comparing unique values Grouped by Datetime Quarters python

I'm working with an extremely large dataset in a Pandas Dataframe. I'm now trying to understand on a quarterly basis: how many UNIQUE sellers have COMMENCED usi

Why do I get worse results in Java than in Python when using the same Tensorflow models?

Introduction: For education purpose I developed a Java class that enables students to load Tensorflow models in the Tensorflow SavedModel format and use them fo

Removing Custom-Defined Words from List - Python

I have a dataframe column that looks like: I'm looking into removing special characters. I' hoping to attach the tags (in list of lists) so that I can append t

How using function np.where along with apply lambda

this code: def nearest_independment(target): lst=df[df['CLINE_TYPE'].str.contains('crease') & df['CLINE_TYPE'].isin(['nan']).shift(2)