Category "python"

What column should I assign to parse_dates while working with google finance?

I wrote a code to show a graph from google finance but i got this error: ValueError: Missing column provided to 'parse_dates': 'Date' This was my code: from bok

Using loop on a list to creat another list from it. but it is printing an empty list

why my code is always printing empty list_of_lists ?? There is nothing wrong with the class and all functions is well implemented I think that the problem is th

How to use rrdtool to read a rrd file in python

I need to read an rrd file using python. Can some one show me how should I use it? I am completely new to this and I could find some usefull thread How to read

Getting a map() to return a list in Python 3.x

I'm trying to map a list into hex, and then use the list elsewhere. In python 2.6, this was easy: A: Python 2.6: >>> map(chr, [66, 53, 0, 94]) ['B',

Datetime Objects on X-axis with matplotlib

I'm plotting some data using matplotlib with DateTime objects on the x-axis, but can't seem to figure out why my DateTime values aren't spaced out on the x-axis

How to combine two columns in pandas dataframe and set values to them?

I have two columns in pandas dataframe Latitude and Longitude. I am trying two combine them in single column LOCATION. If we see the data there are only two loc

Binance API P2P I can´t see the SELL information using Python

I´m getting stuck on trying to bring P2P selling data from Binance using Python. Running the code below I can bring the information from de BUY section bu

Submit form post from another view with input field

I am relatively new to Django and I'm making a small "social" project. It basically consists of user profiles, and on those profiles you can post "comments". I

Unused import statement 'import config' Pycharm

class Bot: @staticmethod def token(): telegramtoken = '...' return telegramtoken @staticmethod def executar(): import

How to only pack values that aren't None

def serialize_header(header): serialized_header = ( resource_type.ResourceType[header.resource_type].value + serialization_method.Serializat

Pydantic validation error for BaseSettings model with local ENV file

I'm developing a simple FastAPI app and I'm using Pydantic for storing app settings. Some settings are populated from the environment variables set by Ansible d

How to make the if condition contain more than one condition? i.e.: if (number % 3 == 0) & (number % 5 == 0): [duplicate]

Starting_Num = int(input('Please enter intial number: ')) Ending_Num = int(input('Please enter ending number: ')) for number in range(Starti

How to read Panasonic .raw files?

I have several .raw file but I am not able to open them on my computer (Mac OS) or in a Jupyter Notebook with Python. I tried to download the module rawpy with

Problems converting a list comprehension

This list comprehension works, but I’d rather have it written like conventional loops: Here is the list comprehension: with open(sys.argv[1], 'r') as f:

How can I go about averaging different sized images?

I have a collection of images from tissue sections which contain a specific area of interest. Given this is biology, each image is slightly different (position

How do I fix pyqt web browser not loading pages

I am trying to make a web browser using pyqt, but every time I click a url it just does not do anything, that or it crashes. For example if I try to open wikipe

How can I add a conditional within my model that changes a model field based on a previous fields value?

Using Django/python. So I have a 'food' model that is taking multiple user inputs, one of which is 'type' and has the options of 'fresh' and 'pantry'. Another i

Cannot create leases container (Gremlin API) with /id as partition key, but comos db trigger requires /id as partition key

I am trying to create a cosmos db trigger for Gremlin API, since the trigger requires partition key as /id, I am not able to create it either from settings in t

How is data transferred between two Python scripts

as an example I have two scripts, say script1.py f = open("output1.txt", "w") count = 1 for i in range(100): f.write(str(count) + "\n

How to make a random sample of panel data (keeping all years for each randomly selected id)

I am using an unbalanced panel dataset, with multiple ids, each with 1 or more years of data. I would like to work with a smaller dataset as I build my code. I