I’m using pandas in python and I have a dataframe where one column is a timestamp and others contain data. The blue line stays constant for a while, then suddenly increases to zero, then at some point descends again to about -98 and stays there until it suddenly goes up to zero. What I need is a new col…
Tag: python
add a single data to serializer in django
I’m writing an API where the user’s followers are listed.I also want to send the total number of followers in this API.But the totalFollower field keeps repeating.I only want it sent once. Like that: MY serializer Answer You have a couple of options: Use a DRF paginator on your view, which will gi…
5-digit-year in date export (52164-01-19 00:00:00+00)
I received a data export from an unspecified source system, which includes dates in the format of: 52164-01-19 00:00:00+00 52992-08-12 04:29:36+00 52838-10-19 04:08:32.999936+00 54022-03-12 17:20:36.999936+00 I was told that the error is caused by a faulty conversion of unix to datetime (seconds and milliseco…
split a workbook into different workbooks with worksheets using python pandas
I have a list of transactions from the last 7 years in one big excel file. I m trying to create an excel workbook for each year that includes each months as worksheet. Im using a column called ‘date’ that has each transactions recorded as MM/DD/YYY. I split that column to single out my years and m…
Export from .tif to .tif with another CRS
I write a code in python for processing some .tif files and put them to WGS 1984 Coordinate System. The problem is, when I run the code, it gave’s me error and stop executing. I try to do this with arcpy.ProjectRaster_management for almost 100 .tif files. Could you help me to make this script to run? Be…
Is it possible to improve my zigzag indicator loop?
I have read on SO and replicated an indicator for stock prices that works as intended. It’s called ZigZag and projects peaks and valleys on historical prices. I pass a pandas dataframe with OHLC prices to my ZigZag class. My problem is that it runs really slow, I have about 70 stocks with 10k rows each.…
Airflow GCSFileTransformOperator source object filename wildcard
I am working on a DAG that should read an xml file, do some transformations to it and land the result as a CSV. For this I am using GCSFileTransformOperator. Example: My problem is that the filename has is ending with a 4 digit number that is different each day (File_20220119_4302). Next day the number will b…
Hashtables Python put method showing IndexError
Below is my SimpleHashTable class. The put(self, key) method should determines where the key is placed in the hashtable when a collision occurs (i.e., calculates the next available index position). Linear probing will be used for collision resolution. I am to do the the following steps: Invoke the get_hash_in…
How to Use jinja to render HTML without flask?
I need to render HTML page using jinja but without flask I read some other questions here but none had clear answer kindly let me know how can i achieve the same Here I need to render 1.html using 1.py – is it possble to do it in ofline mode current 1.py currently with this I am able to print
Can’t convert object of type ‘function’ to ‘str’ for ‘text
Good day everyone I’m sorry I’m new to python programming sorry if I’m asking this even this is basic or not. Someone can help me with this? The problem is I want to put the data that has been read by my Pyserial from my Arduino temperature sensor but I don’t know how. Here code for th…