Category "python"

Odd Linearization of Pydrake Body with Bushing Constraint

I'm currently simulating a four-bar linkage with the bottom link bolted to the ground, and I am using a bushing constraint. I need to use the Linearize function

How to tag nodes implicitly in yaml (PyYAML)

Consider this yaml file: !my-type name: My type items: - name: First item number: 42 - name: Second item number: 43 There is one top level object t

How to use ODBC connection for pyspark.pandas

In my following python code I successfully can connect to MS Azure SQL Db using ODBC connection, and can load data into an Azure SQL table using pandas' datafra

combine two rows with negligible threshold on a groupby dataframe

I have a raw dataframe(simplified) as below: ColumnA startime endtime A 2022-02-23 08:22:32.113000+00:00 2022-02-23 10:54:04.163000+00:00 A 2022-02-23 10:54:04

Drawing an arc using pyqtgraph

I need to draw some shapes on the screen using pyqtgraph. I chose pyqtgraph over matplotlib because the former is way faster when a lot of shapes are present. F

calculate day of the year from 15minute timeseries data

I want a column with day of year. How do I calculate day of the year with 15-minute interval data which are resampled to daily entries. The following code produ

Reading Data in Vertex AI Pipelines

This is my first time using Google's Vertex AI Pipelines. I checked this codelab as well as this post and this post, on top of some links derived from the offic

How can I include external modules when compiling Python code with Cython?

I have an extension that I compile with cython into the related *.pyd or *.so files, which are then imported into my very basic main.py: if __name__ == "__main_

Error status after sending 32768 bytes from serial port in Python

I am making uart communication using serial library. I can send and receive data, but when the number of bytes sent reaches 32768 or more, I get the error; Val

How do you implement SVoice?

I'm trying to use Facebook's SVoice to split out different speakers in my audio file using python. I found a library that implemented it here: https://github.co

I was unable to install my packages from requirement.txt. I keep getting "no module named 'torch'". Please how do I resolve this

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [10 lines of output] Traceback (most recent call last):

Convert text file into dataframe with custom multiple delimiter in python

i'am new to python. I have one txt file. it contains some data like 0: 480x640 2 persons, 1 cat, 1 clock, 1: 480x640 2 persons, 1 chair, Done. date (0.635s) Tue

write a long int as it is by df.to_csv()

I am converting a list of Alphanumerics to hexadecimal values like the following: for j in range(i.item_quantity): it = str(i.item.short_code)+"R1"+"T"+yr[2

how to repeat a numpy vector to create an array with the rest of array being zeros

I would like the create the following numpy array, based on the following vector e = numpy.array([1,0,0,0,0,0]) a = [ [e, 0, ---, 0], [0, e, ---, 0],

Apply function to multiple row pandas

Suppose I have a dataframe like this 0 5 10 15 20 25 ... action_0_Q0 0.299098 0.093973 0.761735 0.0

How to get this single column data into data frame with appropriate columns

I am learning pandas and Data Science and am a beginner. I have a data as following Rahul 1 2 5 Suresh 4 2 1 Dharm 1 3 4 I would like it in my dataframe as Rah

Django for loop in Carousel

I'm trying to add a title to each slide in a dynamic carousel in Django. I have the images functioning properly and working as expected. The title is stacking o

How to solve 'str' object has no attribute 'lemma_' using Spacy?

I tried to do a lemmatization for my DataFrame using Spacy in python. The code that I used is like this below: # import spaCy's language model nlp = spacy.load(

How to break for loop at the end of a line

Task at hand here is to create a dictionary using specified inputs. First element is key and following elements are values. Input: name, George Mason pa, 100.0,

How to read a text file into a list or an array with Python

I am trying to read the lines of a text file into a list or array in python. I just need to be able to individually access any item in the list or array after