Quantcast
Channel: User Bijan - Stack Overflow
Browsing latest articles
Browse All 96 View Live
↧

Comment by Bijan on Telegram Bot "chat not found"

@elliotching i said in my original post.. I got myuserid by sending /getid to @myidbot

View Article


Python-docx Copy Table

I have the following code which I am using to save a table, modify the table, and then make a copy of the table. I got copy_table_after() from Here.def copy_table_after(table, paragraph): tbl, p =...

View Article


Comment by Bijan on tzwhere returns empty even with forceTZ enabled

tzwhere V3.0.3 is compatible with Python3

View Article

Comment by Bijan on Pandas Map Multiple Columns With A Filter

@MichaelButscher it was the second line.

View Article

Comment by Bijan on Pandas Remove First Character From Column if Conditions...

But I want to filter where the first character is x also

View Article


Answer by Bijan for Pandas Extract Phone Number if it is in Correct Format

Figured it out. I created a function that I apply to my phone # fielddef extractNums(number): new_number = list(filter(str.isnumeric, number)) if len(new_number) == 10: return "".join(new_number) else:...

View Article

Pandas Extract Phone Number if it is in Correct Format

I have a column that has phone numbers. They are usually formatted in (555) 123-4567 but sometimes they are in a different format or they are not proper numbers. I am trying to convert this field to...

View Article

Pandas Split By First Delimiter and Add Excess to Different Column

I have a column in my dataframe for email addresses. Sometimes the field contains multiple emails separated by ; EMAIL COMMENTemail1@example.com Example Commentemail2@example.com;...

View Article


Comment by Bijan on Pandas Map Multiple Columns Based on Specific Conditions

This is perfect for my use. Out of curiosity, is replace('',None) needed if my df already has .fillna('')?

View Article


Pandas Map Multiple Columns Based on Specific Conditions

My organization uses special codes for various employee attributes. We are migrating to a new system and I have to map these codes to a new code based on certain logic.Here is my mappings df...

View Article

DataTables filters column when clicking on input field inside Header

I have a DataTables instance that appends a select in the header of a table. Here is a codepen showing it.Here is the relevant part of code that adds the select to the header initComplete: function ()...

View Article

Comment by Bijan on data['Crash Date/Time'] = pd.to_datetime(data['Crash...

What is the format of the data in the Crash Date/Time column?

View Article

Pandas Flatten Row When Doing Groupby

I have a Pandas dataframe that has address and contact information. The rows are on occasion duplicated because there are different values in the respective contact information (the address information...

View Article


gpsread Google Sheets Protect Worksheet with Warning

I am trying to use gspread library to protect a worksheet and warn user if they are about to make a change even if they're an editor.In Google Sheets this is called "Show a warning when editing this...

View Article

Pandas List All Unique Values Based On Groupby

I have a dataframe that has worksite info.District# Site# Address 1 1 123 Bayview Ln 1 2 456 Example St 2 36 789 Hello Dr 2 44 789 Hello DrI am trying to transform this dataframe to add a column with...

View Article


Pandas Unpack List of Dicts to Columns

I have a dataframe that has a field called fields which is a list of dicts (all rows have the same format). Here is how the dataframe is structured:formId fields 123 [{'number': 1, 'label': 'Last...

View Article

Image may be NSFW.
Clik here to view.

Pandas Export to Excel with MultiIndex Column with Formatting

I have a dataframe in Pandas which groups shift attendance for specific daysDAYS = ['26-Aug','27-Aug','28-Aug']SHIFTS = ['S1','S2','S3']EMPLOYEES = ['John Doe','Jane Doe']# Create Column Index of...

View Article


Check if Series has Values in Range

I have a Pandas dataframe that has user information and also has a column for their permissions:UserName PermissionsJohn Doe 02John Doe 11 Example 09 Example 08 User3 11I am trying to create a new...

View Article

Pandas Groupby and Filter based on first record having date greater than...

I have a dataframe that shows details about employees and the site they are at and the positions they have held. The dataframe has columns for Site Id, Employee ID, and StartDate (plus a lot more...

View Article

Pandas Add Unique Values from Groupby to Column

I have a dataframe that lists a users codesUserID Code 123 A 123 B 123 A 456 C 456 DHow do I add a column that shows all of the users unique codes?UserID Code UniqueCodes 123 A [A, B] 123 B [A, B] 123...

View Article

Pandas Add Index to MultiIndex

I am creating a MultiIndex using the following code:idx = pd.MultiIndex.from_product( [df['Day'].tolist(), ['A','B','C']], names=['Day', 'Status'])Which creates:MultiIndex([('01-Jun', 'A'), ('01-Jun',...

View Article


Pandas Return Corresponding Column Based on Date Being Between Two Values...

I have a Pandas dataframe that is setup like so:Code StartDate EndDate A 2024-07-01 2024-08-03 B 2024-08-06 2024-08-10 C 2024-08-11 2024-08-31I have a part of my code that iterates through each day...

View Article


Answer by Bijan for Power Automate Get Filename if Contains Special Character

I ended up just creating an if statement to check if the filename contains filename=if( contains(outputs('HTTP')['headers']?['Content-Disposition'],'filename='), # Check...

View Article

Power Automate Get Filename if Contains Special Character

I created a Power Automate flow that performs an HTTP GET request to download a PDF file and save it to Sharepoint.The filename is in the output of the HTTP headers with Content-Disposition header...

View Article

APScheduler Set misfire_grace_time globally

I am trying to apply misfire_grace_time globally for all of my jobs. According to the Doc Page it says:The scheduler will then check each missed execution time against the job’s misfire_grace_time...

View Article


Image may be NSFW.
Clik here to view.

How to incorporate Select All to select2 in DataTables

I have some code that creates a DataTables table and adds a dropdown to let users filter the options.var datatable = $table.dataTable({ initComplete: function() { function addDropDown(xthis,...

View Article

Pandas Filter and Sum but Apply to All Rows

I have a dataframe that has user ID, code, and value.user code value0001 P 100001 P 200001 N 100002 N 400002 N 300003 P 10I am trying to add a new column that groups by User ID, filters for code = P...

View Article

Comment by Bijan on Pandas Filter and Sum but Apply to All Rows

How would I groupby multiple columns (like user and user_location?

View Article

Pandas Batch Update Account String

My organization has account numbers that are comprised of combining multiple fields. The last field is always 4 characters (typically 0000)Org Account 01 01-123-0000 01 01-456-0000 02 02-789-0000 02...

View Article



Mysql rowcount always returns 1 on INSERT IGNORE statement

I am using pymysql connector to do some inserts into my database. I am trying to return whether or not a record was added or updated.My code isimport pymysqldb =...

View Article

Answer by Bijan for Python Requests Disable zstd Encoding

I was able to find a commit that basically says if zstandard module is installed, add zstd to the Accept-Encoding.Running pip uninstall zstandard fixed my issue.

View Article

Python Requests Disable zstd Encoding

My Synology DS418play recently updated to the latest version of DSM7 that is available. I noticed that a lot of the python scripts that I had have started returning weirdly encoded data. Here is an...

View Article

Nodriver Cannot Start Headless Mode

I found Nodriver, which is the successor Undetected-Chromedriver. I am trying to run in headless mode but am having problems.import nodriver as ucasync def main(): browser = await...

View Article


Comment by Bijan on Change Value DatePicker using Selenium

You misspelled "find_element_by_id". Also it is better to use find_element instead selenium-python.readthedocs.io/locating-elements.html

View Article

SQLite cannot start a transaction within a transaction

I have a script that utilizes the APScheduler module to run certain scripts at set intervals. These scripts are used for all kinds of purposes that make my life easier I also use a simple SQLite...

View Article

Comment by Bijan on SQLite cannot start a transaction within a transaction

Would this cause issue if compareChanges() is called at the same time?

View Article


Comment by Bijan on Pandas Join Two Series Based on Conditions

I was getting KeyError: 0 on the out = df[['Name']].merge... line

View Article


Comment by Bijan on Pandas Join Two Series Based on Conditions

This does not seem to join based on last 4 of SSN though

View Article

Comment by Bijan on Pyhon Telegram Bot Multiple Bots

I am specifically looking for 1 script that can start multiple bots.

View Article

Comment by Bijan on Pyhon Telegram Bot Multiple Bots

@0stone0 Bot1 and Bot2 never reply at the same time. It is okay to have Bot2 process after Bot1. I reference that FAQ page in my original post but I do not understand how to use that code to have 2 PTB...

View Article

Pandas Join Two Series Based on Conditions

I have a dataframe that has information about employee's employment info and I am trying to combine with another dataframe that has their Employee ID #.dfName SSNDoe, John A XXXX-XX-1234Doe, Jane B...

View Article

Browsing latest articles
Browse All 96 View Live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>