Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
64 views

I am trying to make a program to get a list of all (or at least almost all) USA listed stocks on all exchanges. I got AI to generate the following program suggestion: import pandas as pd from ftplib ...
Shawn Duffy's user avatar
0 votes
2 answers
171 views

I have a CSV file keeping track of people's score in a game. I read it with csv.DictReader(). How do I create a dictionary with the keys being the names and the value being the scores? CSV file ...
user31290254's user avatar
1 vote
1 answer
146 views

I'm creating a lookup table / dictionary from a static spreadsheet for upcoming labelling on input data, adding a new field for flavor: lookup_table_data = pd.read_csv(r'C:\Location\format1.csv', sep='...
Chester's user avatar
  • 23
1 vote
2 answers
55 views

I have climate data dataframe in cs format but no headers, so I read data as follows: df_MERRA_data = pd.read_csv(fname,delimiter=',',header=None) df_MERRA_data.columns = \ ['Date-time'...
Steph Bredenhann's user avatar
0 votes
1 answer
29 views

I keep getting KeyError: 'd_ρ' on my d_rho = ... line. I am trying to run the differentials so that I can put them in a table column (or single column per variable), to use for calculating velocity. ...
strueb's user avatar
  • 1
0 votes
1 answer
162 views

Description I'm working with LightningDataModule and wanted to ensure that a method (_after_init) runs only once after full initialization, regardless of subclassing. For that, I implemented a custom ...
Aditya Khedekar's user avatar
0 votes
1 answer
31 views

I have a very simple for loop which was working last week but when I run it this week on exactly the same data it is not working... when I run the code outside of the loop it works without an error. I ...
Heather Kay's user avatar
1 vote
1 answer
96 views

Why does this not work ? Python 3.11.6 (main, Oct 8 2023, 05:06:43) [GCC 13.2.0] on linux Type "help", "copyright", "credits" or "license" for more ...
WillMP's user avatar
  • 11
1 vote
1 answer
58 views

import pandas data = pandas.read_csv("databooks.csv") print(data.titulo) All ok , but: print(data.autor) KeyError: 'autor' autor exists and is well written I expected the autor column ...
Rubén Domínguez's user avatar
1 vote
1 answer
78 views

I have a Python script which iterates through a set of Excel named ranges (DT_1, DT_2, ... DT_30). All ranges are in the same workbook, same sheet and are all named systematically. The script saves ...
Mark Barry's user avatar
2 votes
1 answer
74 views

An enum is declared in an imported package and identically in the importer. Same value, but Python treats the imported enum value as different for some reason. Package 1 is a parser that I wrote which ...
Leon Starr's user avatar
0 votes
1 answer
37 views

I'm building a simple webshop where products in basket are stored in the session dictionary before the user registered (after the information is stored in SQL). The error-handling is not delivering ...
ElvisJr's user avatar
0 votes
0 answers
27 views

"I’m encountering this error in my PythonAnywhere application when trying to read my training files and use them in the final stage. I've repeatedly updated libraries and corrected paths, but the ...
Özge Üstüner's user avatar
0 votes
1 answer
254 views

I am trying to run an SQL statement in Jupyter using the magic line %sql: %load_ext sql %sql sqlite:///FinalDB.db %sql SELECT COUNT(*) FROM TABLE2 but I receive a KeyError: 'DEFAULT' I wonder what ...
hamed rahafrouz's user avatar
0 votes
0 answers
54 views

I was trying to duplicate data from an existing table to an empty table in different schema (all in the same database) and got an error. (PostgreSQL 16): This is for specific exercise, so I have to ...
shira's user avatar
  • 1
0 votes
1 answer
80 views

My Python script uses environment variables, the environment variables are set by Azure configmap, and they are accessible from pod command prompt. They are also available to Python when I run ...
Bhupal.Bobbadi's user avatar
1 vote
1 answer
52 views

I'm encountering a KeyError when trying to use the .apply() method on a pandas DataFrame after performing a groupby. The goal is to calculate the weighted average baced on the Industry_adjusted_return ...
Mostafa Bouzari's user avatar
0 votes
1 answer
84 views

I tried to use pulp to create a decision variable x with 3 dimesions.Then I defined a objective function. However the pulp showed P[j] * min(D[j], pl.lpSum(x[i, j, t] * Y[i, j] for i in fields)) - pl....
user27238111's user avatar
-1 votes
1 answer
80 views

I am new to python and I am trying to conduct multiple PubMed searches and save the number of results in a CSV file. The code I have right now will not run uless I remove my for loop. I would like the ...
Rae Van Sandt's user avatar
0 votes
1 answer
534 views

I created a custom LM Client class like this from dsp import LM import json class CustomLMClient(LM): def __init__(self, model, **kwargs): self.model = model self.provider = "...
Rohan Prasad's user avatar
0 votes
1 answer
189 views

I'm writing a simple mod for a Ren'Py game (to show "hidden" variables). Information about such variables is kept in a lists of dictionaries; like this (simplified): icm_data_rowan = [ { ...
Margo's user avatar
  • 21
0 votes
2 answers
136 views

Using the following program which selects the rows with numbers included in 'Num' in a DataFrame. import pandas as pd data = {'Num': [[1,2,100], [10,20,30], [1,2,30],[1,2,200],[4,0,9]],'Id':range(5)} ...
Franck's user avatar
  • 35
0 votes
1 answer
59 views

I wanted to predict the disease type using a function with a given string parameter. The parameter can contain more than one string. But it always gives an error message: KeyError: 'skin_rash' This is ...
crm revesz's user avatar
0 votes
0 answers
570 views

I want to use streamlit secrets for easy access to my streamlit-app via password. I feel like I did everything as described in the documentation. Streamlit-Doc But I keep receiving the following Error-...
user24930700's user avatar
-2 votes
2 answers
180 views

I'm new to python and I'm programming the Blackjack game in python with a friend of mine. I'm getting Keyerror:0 on this lines: card1=random.choice(cards) card2=random.choice(cards) Is it a writing ...
Leo_Baccuz's user avatar
0 votes
0 answers
33 views

neo4j version 2.3.1, py2neo version 2.0.8, jdk 1.8, python 3.4. The Gremlin service was successfully installed. However, when running the project, it still shows that the plug-in cannot be found: I ...
王伟杰's user avatar
0 votes
2 answers
1k views

So I am doing a problem in Codehs and I have run into a error for one of the problems. I am not very good at programming but I cannot figure out what I have done wrong. I keep getting the KeyError: 2 ...
Logan w's user avatar
0 votes
1 answer
101 views

I am a beginner learning python flask web development. I am currently migrating my program to the web space, but I ran into a problem. My problem is that when you click on the "Check Price" ...
Максим Игрок's user avatar
0 votes
1 answer
47 views

I am writing a program to calculate paces for different track events and I am trying to set a variable that represents the event that the user chose to calculate. Below is the section of the .py file ...
Jacob Ollerhead's user avatar
0 votes
0 answers
50 views

I am working on a Python script that pulls data from an API, turns it to a JSON then goes through and writes a row to a CSV file for a small database, it writes a new row for each of the devices in ...
CantCode2SaveHerself's user avatar
0 votes
1 answer
535 views

I'm encountering a KeyError when trying to access Streamlit's session_state in my Python script, despite initializing the session_state variable. Here's my code: import streamlit as st def main(): ...
gtuor's user avatar
  • 1
1 vote
3 answers
57 views

I have a dataframe that has either column A or B I was hoping for a syntax that uses the or operator to have a stntax like: Value = df.at['Total','A'] or df.at['Total','B'] but I still receive a ...
Bijan's user avatar
  • 8,816
0 votes
1 answer
168 views

chat = await Chat.objects.aget(chatid = chatid) if hasattr(chat, 'agent') and 'active' in chat.status: await asyncio.sleep(5) This code throws KeyError: 'agent'. In Python 3 hasattr uses try-...
Laconic's user avatar
  • 41
-1 votes
1 answer
59 views

I'm pulling in text strings with placeholders for instance attributes. I'm trying to write something that will get the place holder text, find the attribute with that name, and swap it in. I'm able to ...
J Web's user avatar
  • 65
0 votes
0 answers
94 views

I'm trying to update a custom module in Odoo14 whereby I want to introduce a new field or column in the account.move module that tells me which stock.move movement ID, if any, each line in account....
Karistio's user avatar
0 votes
0 answers
93 views

I'm trying to write code that will collect statistics on the sequence of characters in the text and generate new text based on it. This works when collecting statistics with one character, but as soon ...
О. К.'s user avatar
0 votes
0 answers
76 views

Im trying to compare two sets of coordinates in to dataframes using nested for loops. Where distance is less than a predefined value, I want to overwrite the coordinates in the qinsy_file_2. If they ...
tholgate's user avatar
3 votes
1 answer
281 views

I've recently installed the Insurance Management module and I'm trying to enhance its functionality. My goal is to add a page in the CRM lead notebook to display insurances created for each lead. ...
Kamil Wolski's user avatar
0 votes
1 answer
272 views

I have created a pandas dataframe from an API endpoint. I have used the following to convert to a df. df = pd.json_normalize(js.loads(js.dumps(key_value)) This however does create df as required but ...
PHegde's user avatar
  • 45
5 votes
2 answers
8k views

This code gives me an weird error: from langchain_core.output_parsers import StrOutputParser from langchain_core.runnables import RunnableLambda, RunnablePassthrough def create_weaviate_new_RAG(...
Starry Night's user avatar
1 vote
0 answers
114 views

I was making a code in python to put the data in a column of a csv file with pandas but when I ran it it gave me a KeyError. The code is this: import pandas as pd df = pd.read_csv('archivos\\hi.csv') ...
Daniela's user avatar
  • 11
0 votes
1 answer
76 views

I have an excel file from which I retrieve data with pandas. I have a dictionary where keys are the same strings that I get from a cell from the excel file. For example, I have a excel cell that ...
python3 programmer's user avatar
-2 votes
1 answer
245 views

I'm using python 3.12, and keep getting this error message when I try to run my code: KeyError: 0 The above exception was the direct cause of the following exception: Traceback (most recent call last)...
Khalid oti's user avatar
-1 votes
1 answer
80 views

I'm building this app where I can see live cricket scores using this API. When I'm trying to access the teams name its giving me a key error which doesn't make sense as the key does exist. import ...
Saif1708's user avatar
-1 votes
1 answer
160 views

I'm trying to use the PykTok module on an ec2 instance. It's set up to work (I've the right versions of everything) When I execute my script I got this error : KeyError: 'DBUS_SESSION_BUS_ADDRESS'. ...
Zefus's user avatar
  • 11
2 votes
2 answers
382 views

I have the following issue with Polars's LazyFrame "Structs" (pl.struct) and "apply" (a.k.a. map_elements) in with_columns The idea here is trying to apply a custom logic to a ...
J. Alvarez's user avatar
0 votes
0 answers
45 views

In my python program I'm getting this error: Exception has occurred: KeyError 'labels' KeyError: 'labels' I'm getting error from this code: labels = data['labels'].reshape(-1).astype(np.int32) Can ...
Arghya Chatterjee's user avatar
-1 votes
1 answer
222 views

I have written some code for a linear regression model to predict house prices. I'm witting exactly the same as a tutorial video; when I write random_state=42 it works without any error, but when I ...
Merzaee's user avatar
  • 601
0 votes
0 answers
2k views

current_weather_url = 'https://api.openweathermap.org/data/2.5/weather?q={}&appid={}' forecast_url = 'https://api.openweathermap.org/data/3.0/onecall?lat={}&lon={}&exclude=current,minutely,...
Akshay Kumar Dubey's user avatar
-2 votes
1 answer
136 views

I am solving a leetcode problem 17. Letter Combinations of a Phone Number. I have coded this solution using Python3. class Solution: def letterCombinations(self, digits: str) -> List[str]: ...
Wreetbhas Pal's user avatar

1
2 3 4 5
24