Category "python"

How to pass python 2d matrix to C function ctypes

I tried to pass my matrix from python to C++ based on ctypes to multiply by 2 but I could not get the result that I want because it says inf instead. C code (DL

Python lxml cannot handle XML element with over 1GB of text

The lxml library for Python can handle extremely large XML files, up to (and over?) 100 GB in size. But can it handle extremely large (1 billion characters or m

Pandas Merging 101

How can I perform a (INNER| (LEFT|RIGHT|FULL) OUTER) JOIN with pandas? How do I add NaNs for missing rows after a merge? How do I get rid of NaNs after merging?

convert a CSV file to JSON file

I am trying to convert CSV file to JSON file based on a column value. The csv file looks somewhat like this. ID Name Age CSE001 John

i'm getting this error when running the below pyflink code

this is the code for calculating average of each ch[x] from a kafka source using apache flink(pyflink) i think i have imported all of the necessary libraries An

Using scipy fsolve and odeint for simultaneous ODEs

I'm trying to solve a set of transient flow equations of a body firing from a pressurised tube from scipy.integrate import odeint import numpy as np # paramet

Comparing lists within dataframe column to another list using numpy's where function

This is my first post at Stackoverflow, so thank you for the help. I am trying to replicate a code where I can match a list within a dataframe to another list,

How do I decode the hex from a specific part of a BSC transaction receipt, using web3 py?

I am writing a python script using web3 package. The process explained: I have a transaction, which I read the transaction receipt for txn_receipt = w3.eth.getT

Pytorch model object has no attribute 'predict' BERT

I had train a BertClassifier model using pytorch. After creating my best.pt I would like to make in production my model and using it to predict and classifier s

Custom rate for adding user to test process in locust

I'm pretty new to locust and load testing, I need to write a load test that should be for a total of 30 users, these users should be added to the test step by s

Low accuracy after testing hyperparameters

I am using VGG19 pre-trained model with ImageNet weights to do transfer-learning on 4 classes with keras. However I do not know if there really is a difference

Creating Python zip for AWS Lambda using Bazel

I've a monorepo that contains a set of Python AWS lambdas and I'm using Bazel for building and packaging the lambdas. I'm now trying to use Bazel to create a zi

Apache Beam with Dataflow: flag 'ignore_unknown_columns' for WriteToBigQuery not working

I am building a streaming pipeline using Apache Beam (Python SDK version 2.37.0) and Google Dataflow to write some data I receive via Pubsub to BigQuery. I proc

plotly dash link to local html file

i want to link a local HTML file to a plotly dash table. from dash import Dash from dash_table import DataTable import pandas as pd df = pd.DataFrame( {

Caused by: java.net.SocketTimeoutException: Accept timed out

I am getting this error while running pyspark package in pycharm using python 3.9 using this below code. from pyspark.sql import SparkSession from pyspark.sql.t

Pytest logging ignores dependency warnings

I have a simple python script that leads to a pandas SettingsWithCopyWarning: import logging import pandas as pd def method(): logging.info("info") l

How to customize general error messages of numpy?

I am writing a Vector and Matrix classes that use numpy in the backend in order to abstract some common methods and calculations (specifically, physics calculat

Conversion between binary vector and 128 bit number

Is there a way to convert back and forth between a binary vector and a 128-bit number? I have the following binary vector: import numpy as np bits = np.array([

How to make SPOT market order on Bybit with ccxt?

I am using ccxt library to work with exchange. Struggling with making market order on Bybit. How it can be fixed? The error i've got is TypeError: Exchange.requ

Add a comma after two words in pandas

I have the following texts in a df column: La Palma La Palma Nueva La Palma, Nueva Concepcion El Estor El Estor Nuevo Nuevo Leon San Jose La Paz Colombia Mexico