Category "python"

Check whether deployed in cloud

I have a python program running in a Docker container. My authentication method depends on whether the container is deployed in GCP or not. Ideally I'd have a f

Selenium getting stuck when looping through pages

I have written code that pulls text from sites and analyses them for readability. However, I sometimes get stuck on sites. Is there any way for me to have my pr

why this line of my code crash the archive?

This part of the code for some reason doesn't allow me to read anything from the file correctly. It's like I delete everything and leave white spaces or somethi

How to combine two dataframes into one like this, using pandas and python?

Please see the picture here. I have two data frames and i need to convert it into single one, using merge or concat method and i am unable to do so. Can our com

Regex for a extracting a string starting with a particular word and ending with a year

INPUT 1: The string is enclosed CASE NO.: Appeal (civil) 648 of 2007 in between. OUTPUT 1: Appeal (civil) 648 of 2007 INPUT 2: The string is enclosed CASE NO.:

why this line of my code crash the archive?

This part of the code for some reason doesn't allow me to read anything from the file correctly. It's like I delete everything and leave white spaces or somethi

Splitting a record into 12 months based on the date in pandas dataframe

I have the data in the below format stored in a pandas dataframe PolicyNumber InceptionDate 1 2017-12-28 00:00:00.0 https://i.stack.imgur.com/pE

How to get correct date format from JSON string in Python?

I am trying to get some data from a JSON url using Python and convert in Pandas PD. Everything is working OK. Only there is a column for date. It is coming weir

How to remove space from number followed by unit or dimensions?

Here is the input string string1 = 0.9% SODIUM CHLORIDE 8290306544 FLUSH 0.9 % SYRINGE 10 ML string2 = 0.9% SODIUM CHLORIDE 8290-3071-44 FLUSH 0.9 % SYRINGE 10

Exception has occurred: NoSuchElementException - iframe will not work

from discord_webhook import DiscordEmbed, DiscordWebhook from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.comm

creating a fuzzer for ftp [duplicate]

I keep getting the error when I try to connect to the ftp server: a bytes like object is required not str #!/usr/bin/python import socket s

Finding the minimum result of a list of results

Is there a code to define / sort through lists?

Apache beam: Reading and transforming multiple data types from single file

Is there a way to read each data type as it is by a PCollection from a CSV file? By default, all the values in a row read by a PCollection are converted into a

Print out a list of prime numbers in python

The question is: print out all numbers from 1 to 1000 that satisfy the two conditions: Those are prime numbers The numbers after being reversed are also prime n

Get the mtime of a symlink and not its target in Python

In Python (and Python2) on macOS, when I use os.path.getmtime('/path/to/a/symlink') I get the modification time of the symlink's target. - How do I get instead

Lib Spotipy no responde

i'm trying to use the lib Spotipy for Spotify. When i execute the code below, nothing happen. I have a springboot app who receives the token generated, when i t

Mac - include Python.h framework when compiling a cpp file

I'm currently building a cpp project which contains python code. To use embed python code in c++ the Python.h file from the Python.framework is required. Before

Merge two dfs with multiple entries of same value in joining column

I have two data frames. The first is input which looks like the following: Merchant SKU Quantity Per Box NOB Shipment Status id_using_regex prepped_by_in

Pymongo: update document only if value of a field matches a provided value

Is it possible to update a document based on the condition that the value of a field in that document matches a value that I provide? I can easily do this in tw

What exactly is current working directory?

My book states: Every program that runs on your computer has a current working directory, or cwd. Any filenames or paths that do not begin with the root folder