Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
31 views

I am trying to use the Kiwoom OpenAPI (for making automated stock trading program), which requires a 32-bit Python environment. However, to successfully use Kiwoom Open API I need to set up pandas in ...
Fish Red's user avatar
0 votes
3 answers
60 views

I have a dataFrame with columns Age, Salary and others, if I used: df['Age'] = df['Age'].apply(lambda x : x+100 if x>30 else 0) Then I can modify the Age column with the if else condition. Also, if ...
Edy's user avatar
  • 13
3 votes
1 answer
110 views

I have two pandas series: right_series Index Value 1 0.1 2 0.2 3 0.3 6 0.6 7 0.7 left_series Index Value 1 0.1 5 0.5 10 1.0 I would like to join right_series on left_series by the indices, such that ...
Billy Pilgrim's user avatar
0 votes
1 answer
82 views

I noticed that groupby().apply() produces different results for two groups that look identical, except that the overall DataFrame has duplicate index values. Here is a minimal reproducible example: ...
Bhumika Aggarwal's user avatar
-1 votes
1 answer
68 views

I am trying to find a combination where it will go through the data to find matched variables for any value from the list First_row is found, any value from the list Second_row and any value from the ...
Kan's user avatar
  • 41
Advice
1 vote
3 replies
126 views

I've got four years of daily school attendance data spread across 40+ Excel files (one for each month) and the sheets are set up in a truly annoying fashion, with each date in one merged cell in the ...
user28348051's user avatar
2 votes
4 answers
149 views

I got a dataframe df1 which looks like this: Column1 Column2 13 1 12 1 15 0 16 0 15 1 14 1 12 1 11 0 21 1 45 1 44 0 The 1s indicate that a measurement started, I don't know how many 1s will be in one ...
toben aus's user avatar
5 votes
2 answers
105 views

Consider the following pandas Series with a DatatimeIndex of daily values (using day-of-year as an example): import pandas as pd dti = pd.date_range("2017-11-02", "2019-05-21", ...
Mike T's user avatar
  • 44.4k
0 votes
2 answers
92 views

I'm trying to create a Pandas DataFrame from a JSON file that looks like this: { "GameID": "1,218,463,841", "Date - Start": "1761097369", "Date - End&...
Margot Sibson's user avatar
1 vote
1 answer
109 views

How can I handle string values that contain patterns like xxxE205 (e.g., 2004E205), which are used as unique codes in my company? I explicitly read the column as a string in pandas, but values ...
Ethan MK's user avatar
Tooling
0 votes
2 replies
67 views

I would like to know how to export or import TOON (Token object oriented notation) in pandas.
Rainb's user avatar
  • 2,567
2 votes
1 answer
129 views

I have a data frame and I am trying to convert the time column into a datetime format. The first step I did was: data['time'] = data.time data['time']=pd.to_datetime(data['time'], format='%H:%M:%S.%f')...
Hamza Rehan's user avatar
3 votes
2 answers
210 views

I have a DataFrame with a column Digit of digits at base 10. For example import numpy as np import pandas as pd df = pd.DataFrame({ "Digit": [ 1, 3, 5, 7, 0, 0, 0, 4, 8, ...
Max Pierini's user avatar
  • 2,323
0 votes
1 answer
87 views

II'm currently learning the Pandas library in Python (without AI assistance), and in one of my tasks I needed to count how many times each item appeared in a row of a DataFrame. Here's an example of ...
Mauricio Reisdoefer's user avatar
2 votes
1 answer
73 views

I am working on a dashboard using Shiny for Python and Plotly Express. I am trying to create a Gantt chart (using px.timeline) to visualize the operating periods of different boilers (ON/OFF states). ...
Juan Siécola's user avatar
-4 votes
0 answers
75 views

I am trying add one pandas DataFrame to another DataFrame. How can I do this in the style of list.append? usernames = {"anvar":"anvar123", "behruz":"Bex124", &...
Ravshanjon Ahmadjonov's user avatar
Best practices
0 votes
6 replies
109 views

End Objective Download some data from the internet (about 5 GB in size) Possibly convert some strings/datetimes Upload to Postgres database I have written some code which uploads some data to a ...
user2138149's user avatar
  • 18.7k
1 vote
2 answers
139 views

I have one dataframe with sessions - one session, one row, so SID is unique. The session has a doctor name. SID Doctor Patient 1 robby david 2 langdon sara 3 langdon michael I have another dataframe ...
Semyaz's user avatar
  • 11
12 votes
0 answers
326 views

It is a while that I am using Data Wrangler extension in VS Code; it is very useful for analyzing datasets and filtering some columns to see the features. When I opened a dataframe in it, it used to ...
Javad Faraji's user avatar
0 votes
1 answer
84 views

def prepare_dataframe(df): # Map original CSV column names to internal aliases for easier access df.rename(columns={ 'Bomba Calor - Temperatura de Aire (°C)': 'temp_aire', '...
Juan Siécola's user avatar
1 vote
1 answer
96 views

I'm trying to store API output into CSV/db and can not figure out how I can make for those Key in "tierList". One row in my case should be on bin and I need key as a columns in my output. Is ...
user1982778's user avatar
4 votes
1 answer
94 views

a = np.array(["foo", "foo", "foo", "foo", "bar", "bar", "bar", "bar", "foo", "foo", &...
Tyler's user avatar
  • 139
0 votes
0 answers
39 views

I have a table/df that holds a set of code and value pairs. The codes are a mix of old (legacy) and new codes due to process changes. I have a second table/df that holds the old codes, new codes, ...
MikeB2019x's user avatar
  • 1,297
0 votes
1 answer
55 views

I read data from Databricks import pandas as pd import joblib query = 'select * from table a" df = spark.sql(query) df = df.toPandas() df.to_pickle('df.pickle') joblib.dump(df, 'df.joblib') ...
user1700890's user avatar
  • 7,824
Advice
0 votes
0 replies
48 views

I have the following data format: foo0/bar0/a0/b0/c0 50 foo0/bar0/a0/b1 30 foo1/bar0/a0/b0 10 foo1/bar1 20 foo1/bar2/a0/b0/c0 20 foo1/bar2/a0/b0/c1 30 I'd like to create a sunburst plot out of this. ...
jkang's user avatar
  • 579
1 vote
1 answer
59 views

i'd like to know if there is another better way of using df_filtered_dates = df.loc[start_date:end_date] or of this way it's good, i'm using for filter dates between the dates i choose from ...
Juan Siécola's user avatar
-3 votes
1 answer
97 views

I am trying to display the headers of a data frame I created based on a csv file using the PythonAnywhere free version. I keep getting a huge error message and I don't understand what I did wrong. ...
user31868639's user avatar
Best practices
0 votes
3 replies
99 views

What is the right/pythonic way to do math on a few indexed elements in a Pandas Dataframe? I tried a few ways but they seem awkward and confusing: df = pd.DataFrame({'x': [1, 2, 3, 4, 5, 6, 7, 9, ]}) ...
Dave X's user avatar
  • 5,247
0 votes
1 answer
79 views

Essentially I haven't been able to parse a pandas DataFrame into an Excel table properly, I have the output working but the headers remain being passed as if the were an extra row ws.append([]) ws....
Sakura NoTamashi's user avatar
1 vote
1 answer
62 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
1 vote
2 answers
86 views

I have a DataFrame that contains an A/C number column, where some values are longer than 15 digits. When I export the DataFrame to Excel using .to_excel(), Excel automatically converts these long ...
pritesh's user avatar
  • 21
1 vote
1 answer
65 views

I need to take an integer input value, assign it to a variable, and then use that variable as a column name to get data from a pandas DataFrame. Data: 1 10 20 30 2 40 50 60 Steps: Assign input to ...
madhu chatim's user avatar
1 vote
0 answers
64 views

I was reading the pandas documentation: pandas.DataFrame.apply documentation In this definition, it seems to me like the use of axis is the exact opposite of what it means in other functions? To apply ...
Jacoberu's user avatar
1 vote
1 answer
113 views

Here is my code: import pandas as pd import datetime df = pd.DataFrame({'str_date': ['2023091004']}) df['epoch'] = pd.to_datetime(df['str_date'], format='%Y%m%d%H').astype(int) // 10**9 dt = ...
user1700890's user avatar
  • 7,824
0 votes
0 answers
59 views

I’m fetching ENTSO-E imbalance prices/volumes with entsoe-py and hit a parser crash because the <position> field contains a thousands separator comma (e.g. "1,346"), which int() can’t ...
EmmaW23's user avatar
0 votes
0 answers
118 views

I'm new to Python, so please be lenient. I want to read the value of a single cell from a dataframe based on the selected row. I do this as below, but I get the value not when I click on a record (...
Szymon Tomtała's user avatar
1 vote
2 answers
153 views

I am using Python with a pandas dataframe, it is a CSV of Steam games, and I have the categorical columns of publishers, developers, categories, genres, and tags, but categories, genres, and tags are ...
Luciano Elish's user avatar
3 votes
2 answers
134 views

Having this kind of pandas dataframe df = pd.DataFrame({ 'ts_diff':[0, 0, 738, 20, 29, 61, 42, 18, 62, 41, 42, 0, 0, 729, 43, 59, 42, 61, 44, 36, 61, 61, 42, 18, 62, 41, 42, 0, 0] }) ts_diff - is ...
ihtus's user avatar
  • 2,863
-6 votes
1 answer
116 views

import pandas as pd a=1 b=2 c=3 for n in range(10, len(df)-1): if df.loc[n].isin([a]).any() and df.loc[n].isin([b]).any() : for x in range(0, ...
Kan's user avatar
  • 41
Best practices
0 votes
7 replies
122 views

I was trying to calculate the accuracy of my roberta label and pre existing dataset label i was confused on how to operate pandas's value_counts(), i dont know how to do operations on it before, the ...
Fauzan Anggito Wicakson's user avatar
3 votes
3 answers
193 views

Hopefully the title is reasonably intuitive, edits welcome. Say I have this dataframe: df = pd.DataFrame({'x': ['A', 'B', 'B', 'C', 'C', 'C', 'D', 'D'], 'y': [None, None, 1, 2, 3, 4,...
Hendy's user avatar
  • 10.7k
Best practices
0 votes
5 replies
204 views

I am building a python service to compute Greek values using python, but I have never worked on python, and I would appreciate advice from the experienced python devs as it would help me a lot. FLOW ...
NOOB DEV's user avatar
2 votes
1 answer
121 views

I have a dataframes pulled from a file. The variable with all these dataframe names is: Data_Tables. These dataframes all have the same columns, and I want to concatenate the dataframes based on the ...
Jon S's user avatar
  • 55
2 votes
4 answers
128 views

I am still a beginner in python. I am trying to find a common value with if statement, import pandas as pd df = pd.read_csv("data.csv") for n in range(2, len(df)): if df.loc[n].isin([2]...
Kan's user avatar
  • 41
5 votes
3 answers
189 views

I want to format a Pandas DataFrame with a hyperlink based on the index. import pandas as pd df = (pd.DataFrame([dict(food='bananas', count=33, color='yellow'), dict(food='apples',...
Jason S's user avatar
  • 191k
1 vote
0 answers
77 views

There is a dataframe with a multiindex columns: import pandas as pd df = pd.DataFrame({ "A": ["foo", "foo", "bar", "bar"], "B": [&...
VictorS's user avatar
  • 11
5 votes
3 answers
168 views

I have below pandas dataframe import pandas as pd data = pd.DataFrame({'x1':range(10, 18), # Create pandas DataFrame 'x2':['a', 'b', 'b', 'c', 'd', 'a', 'b', 'd'], ...
Bogaso's user avatar
  • 3,896
1 vote
1 answer
90 views

In a Lambda, I'm using AWS Wrangler to read data out of a date partitioned set of parquets and concatenate them together. I am doing this by calling wr.s3.read_parquet in a loop, compiling the loaded ...
AngusB's user avatar
  • 80
3 votes
1 answer
215 views

I have code that detects a table in a PDF that appears after a specific section, and parses the information in the table and copies it into a pandas dataframe. Now, I want to indicate whether a box is ...
user2813606's user avatar
0 votes
0 answers
135 views

I have just installed the new Mint 22.2 as my old hard disk with Mint 21 seems to have some issues. I use Eric-IDE to execute my .py script. The script is first downloading stock values from a certain ...
Henning's user avatar
  • 27

1
2 3 4 5
5785