Category "python"

How to handle Firebase Cloud Messaging Notifications in Django?

I am managing to send FCM notifications to my app through Django. Here is my function for pushing notifications: import firebase_admin from firebase_admin impor

PicklingError: Could not serialize object: ValueError: Cell is empty when training elephas-keras model inside pyspark

i am new in using pyspark with elephas and tensorflow i am trying to train a deep learning model inside pyspark using elephas module my code : https://www.kaggl

How to create a list of all elements present in a single cell of a dataframe?

Let say I have a dataframe: now i want list of the elements present in the column NAME like this: ['s', 'a', 'c', 'h', 'i', 'n'] how can we do this in pyspark

PyQt4 qApp.topLevelWidgets() causes segmentation fault sometimes(!)

all 3 variants: QtGui.qApp.topLevelWidgets() QtGui.QApplication.instance().topLevelWidgets() app = QtGui.QApplication(sys.argv) app.topLevelWidgets() sometim

How to get the paper status of my Thermal Printer using python-escpos?

Currently, I am developing an ordering system that uses a thermal printer. my code looks like this. from escpos.printer import Usb p = Usb(idVendor=0x471, idPro

Python glob multiple filetypes

Is there a better way to use glob.glob in python to get a list of multiple file types such as .txt, .mdown, and .markdown? Right now I have something like this

How can I convert a row from a dataframe in pyspark to a column but keep the column names? - pyspark or python

I have an array where it is made up of several arrays.

Parse Year Week columns to Date

I have a data frame with columns Year and Week that I am trying to parse to date into a new column called Date. import datetime df['Date']=datetime.datetime.fro

How can I apply multiple conditions in Pandas, with Python?

How can I apply multiple conditions in pandas? For example I have this dataframe Country VAT RO RO1449488 RO RO1449489 RO RO1449486

How can I iterate through two lists in parallel?

I have two iterables in Python, and I want to go over them in pairs: foo = (1, 2, 3) bar = (4, 5, 6) for (f, b) in some_iterator(foo, bar): print("f: ", f,

How to transform TfidfVectorizer() outputs in dataframes

I found this answer about the model and specific outputs (How to get top n terms with highest tf-idf score - Big sparse matrix). It was great. I would like to k

How do I generate a partial view of a mesh as a point cloud in Python?

I have a dataset of meshes, which I want to use to generate partial view data as point clouds. In other words, simulating the way an RGB-D sensor would work. My

Cublic Spline Interpolation of Phase Space Plot

I am creating a phase-space plot of first derivative of voltage against voltage: I want to interpolate the plot so so it is smooth. So far, I have approached t

Python kivy position of the Label moves when resizing screen

I'm making an app in python kivy and in my tacscreen I have a draggable Image and an Label, whenever I drag my draggable Image my label drags with it as well. T

Flask CSS Error after pressing submit button

I have a flask web that makes prediction and returns it. The index page is rendered, the model receives data and makes a prediction and shows it correctly. But

SAM-local fails to start API with multiple stacks

I want to add resources to my root stack and somehow found a function where I can first get stack first like this my_api = RestApi.from_rest_api_attributes(

How to import a .sql file into DuckDB database?

I'm exploring DuckDB for one of my project. Here I have a sample Database file downloaded from https://www.wiley.com/en-us/SQL+for+Data+Scientists%3A+A+Beginner

Pre-release version number in mixed python/rust project with maturin

I am working on a mixed Rust/Python project being build with maturin. I am having trouble figuring out how I can specify a pre-release version that can than be

columnwise extended attributes in python for use in SAS

I have a requirement to create extended attributes (XATTR) on columns in the python data frame. Reason: I need to import this dataset from python into SAS where

Pandas - Key Exception - Length mismatch: Some times Expected axis has 3 elements, Some times has 2 elemnts

I have built a script to update stock values from yahoo finance with pandas. Sometimes the script works fine, but at some point it gets an error: Key Exception