Category "python"

how to retrieve sector and industry for a list of tickers with python?

I have a list of tickers (below: tick1) that comes from the Earnings Report. I would like to add the "shortname", "sector" and the "industry" next to the ticker

Creating an instance in OWLready2 creates a completely new class instead of asigning it to the existing class

I'm trying to create a simple ontology, following the tutorial on the official website. The code runs smoothly and everything seems fine when running this code:

`pd.read_sql(sql, engine)` raises NotImplementedError: This method is not implemented for SQLAlchemy 2.0

I tried to create a pandas DataFrame directly from my sqlserver database using an sqlalchemy engine: engine = create_engine(URL_string, echo=False, future=True)

KeyError(key) from new variable assigned to dataframe

The rates data frame I read from a csv file: rates = pd.read_csv(r'C:/Users/Owner/Documents/Research/SOMA/SomaFinal.csv', usecols=[0, 1, 2, 3],

Is it possible to use an XCom from an operator parameter without using Jinja?

Is it possible to pass an XCom to an operator parameter without using a Jinja template? I have a dict stored in an XCom and I need to pass it to an Operator tha

ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context'

My notebook was working up till today. At the beginning of my colab notebook I install tf-nightly, but now it is giving me this error: -------------------------

Learning to use Tweepy and Twitter API

I'm currently trying to learn the Twitter API within Python. My code is this: import tweepy consumer_key = "Consumer Key" consumer_secret = "Consumer Secret"

Problem to convert act format to CSV a bytes-like object is required, not 'str'

I have a problem converting an .act file to csv format. I am using this code: import struct import csv DATA = [] with open("modis_lst.act", "rb") as actFile:

How to overcome value error python model prediction?

I have trained a model and now my task was to test it on unseen images from the internet. Originally the model was trained on CIFAR-10 so for the model I chose

I would like to edit an odt document using python. Just a simple swap of keywords. Is this possible?

1)I would like to swap certain keywords in an odf document programmatically. For example, the sample lease has TENANT_NAME, and my program would insert the actu

pythonanywhere django static files are not collected from application

The problem is that static files from Django app are not being collected in pythonanywhere. After the command python manage.py collectstatic In the directory /

Matplotlib not plotting at all correctly, not seen anyone else have this issue

So, I'm trying to code with matplotlib, so that it plots coordinates of the majority of cities in the USA on a graph. As should be evident by the fact I'm askin

What is the Python equivalent of a Promise in JavaScript?

I am trying to understand what would be the best code structure or a design pattern that would do the following: Have a function named get_data that would start

pandas | list in column to binary column

I have the following dataframe: +------------+------------------+ | item | categories | +------------+------------------+ | blue_shirt | ['red', 'wh

Chainladder: does it work with multi-triangles with non-aligned valuation periods?

Trying to extract properties from the triangle / development class(e.g..age_to_age) give it was parameterized with multiple triangles each with different valuat

Django rest framework: Unit testing post request gets status code 400

I'm doing some unit tests in this restaurant app, and the API request to cancel orders returns code 400 when running "manage.py test" command, but doing the sam

Linear Regression statsmodel: Missing a required outcome variable

I am using statsmodel to build a linear regression for salary. It's giving me an error that says I am missing a required outcome variable. Can you tell what I

How to find current upper Bollinger band in pandas-ta

I have a CSV file having columns Instrument, Date, Time, Open, High, Low, Close I want the rows having Current close greater than current upper Bollinger band(2

Removing a list in a list of lists if a condition not satisfied

I have a list of lists. I want to remove lists if the lenght of intersection of values in the list with previous lists is more than one. For example A=[(1,2,3,4

Selenium TypeError: __init__() got an unexpected keyword argument 'service'

I'm refactoring my app from procedural code to OOP. I am trying to do this Driver class. UPDATE: this works in Windows but not in Mac. # IMPORTS from sys import