Category "python"

Great Expectations: How to add a partition (column partition) in an Athena External Table in a checkpoint reference in GE?

The setup is GE v3 and I am using AWS Athena as a Data Source. However, I couldn't find a way to tell the "expectation" that the table in actually partitioned w

Python Date cleaner using regex

I've been trying to do a script that takes date inputs like 3/14/2015, 03-14-2015, and 2015/3/14 (using pyperclip to copy and paste) and modifies them to a sing

How to extract date out of string using date time

if for example I have a string like this import datetime as datetime string = "Hello todays date is 11/02/2022 thanks" How may I use datetime to extract just t

AttributeError: 'PermissionOverwrite' object has no attribute 'items' when editing a VoiceChannel

This line of code await channel.edit(user_limit=0, name="💤|Dormant", overwrites=discord.PermissionOverwrite(read_messages = False)) Sourcing from elif

Python cant find database if script is run from other file

I have this struggle with a dataheavy project. I can run a file that uses a query file -- Al the query's and converters are in here -- without problems, but whe

How to flatten a nested Json struct using Python databricks

Trying to flatten a nested json response using Python databricks dataframe. I was able to flatten the "survey" struct successfully but getting errors when i try

How can we extract a next numeric value to a string in python

There is a need that I have a taken a output in a string such as string is "Initial: [818 v1] any other string or words here" and here I want to take 818 from t

Python Seaborn and Pandas Data Presentatation in Graphical Form

I was trying ML in python. During the process I had to come across seaborn.pairplot or other plot function and pandas.plot functions. To be simple I'm putting t

Why does howSum solution work in Javascript but not in Python? (Dynamic programming)

This is a follow-up to this question asked on Stack Overflow. Write a function 'howSum(targetSum, numbers)' that takes in a targetSum and an array of numbers as

How to iterate over rows of each column in a dataframe

My current code functions and produces a graph if there is only 1 sensor, i.e. if col2, and col3 are deleted in the example data provided below, leaving one col

Failed to decrypt data with Fernet - TypeError: token must be bytes

I'm trying to make simple encrypt/decrypt cli script. I'm getting an error while decoded the encrypted text. TypeError: token must be bytes If I use str.encod

Split string on Upper Case word

I have a string with 2 phrases, separated by an upper case word in the same string: c="Text is here. TEST . More text here also" I want to separate both phrase

How to calculate 2d X-ray image projection given camera orientation (theta, phi, distance) and 3d object coordinates

I'm trying to recreate an X-ray projection I have 3D coordinates of an object of shape (100,3), spherical coordinates of the camera (theta, phi, distance), dist

CV2 puttext is not adding special characters

I am trying to update text om images using CV2.Puttext feature. Its adding all english words properly but special/asci characters like №,■,<<,

Generating a shuffled range in python

I need to generate (iterator) a random sequence of 32 bit integers with absolutely no repeats. The naive solutions to this problem don't work for me because of

Change color of y axis label in plotly

I draw a figure in plotly (python). To change the label color of y axis in the plot I used the code fig.update_yaxes(color='white') and fig.update_layout(font_c

Python get path to executable file?

I'm very new to Python programming and I've cobbled together some code that will hopefully automatically rename a bunch files in a specific folder. I need to ru

Importing DICOM image path (using MacBook, google collab) but getting [Errno 2] No such file or directory

I'm having trouble reading the file path that contains a DICOM image. I'm familiar with retrieving a file path on Windows and reading it but I'm currently using

How to fetch files from Windows Shared Network Drive and upload to Azure Data Lake Storage location using Python?

I have requirement where I need to fetch files (having .xml as extension) from Windows Shared network drive location and upload them to ADLS (Azure Data Lake St

Speed up millions of regex replacements in Python 3

I have two lists: a list of about 750K "sentences" (long strings) a list of about 20K "words" that I would like to delete from my 750K sentences So, I have to l