All Questions
Tagged with pandas python-3.x
31,288
questions
0
votes
0
answers
31
views
Why data that are being written to excel are not starting from the 'A' column?
I'm using pandas to copy data from one excel to another and the data are being copied just not at the right place.
I have this function that reads the data:
def updated_file(self, progress_bar):
...
-2
votes
1
answer
62
views
Convert time into seconds [removing milliseconds]
I have a Pandas dataframe where, column name 'A' has date and time value (as of now it is of type string).
Column A
Column B
2024-07-11 13:09:37.466
PC2
2024-07-11 13:24:43.03
PC1
May 6 2024 22:49:...
0
votes
1
answer
20
views
RDKit PandasTools WriteSDF: RuntimeError: Bad pickle format: unexpected End-of-File while reading
I face the error:
PandasTools.WriteSDF(pp, args.output_file, molColName='ID', properties=list(pp.columns))
File "/scratch/micromamba/envs/biotools_py39/lib/python3.9/site-packages/rdkit/Chem/...
-1
votes
0
answers
25
views
NameError Traceback (most recent call last) <ipython-input-3-9ec55f7a7976> in <module> : NameError: name 'books' is not defined
I am trying to plot the evolution of degree centrality over the books for some of the characters from Game of Thrones .I have a list evol that contains the computed degree centrality from all the ...
0
votes
2
answers
50
views
Converting JSON list with multiple nested dictionaries to csv or excel
I have a JSON that I download from a website that has multiple nested dictionaries inside the main list. This is a very simplified version of it.
[
{
"id": 1,
"...
1
vote
1
answer
51
views
How to group rows based on column ID in a pandas dataframe?
I have below the dataframe below df1:
ID Label Value
id_1 A
id_1 B
id_1 C
id_1 D
id_1 E
id_1 10
id_1 20
id_1 30
id_2 F
id_2 G
...
-4
votes
0
answers
70
views
How to split CSV data with newline, commas, quotes in the column of data? [closed]
I want to split the data line by line, but I am receiving newline and quotes in the data which is not allowing me that to split it by either newline.
CSV Data Received:
ISSUE ID,FACTOR NAME,ISSUE TYPE ...
-1
votes
1
answer
40
views
Python Pandas Dataframe: Make Rows from Multiple Column Into Multiple Column [duplicate]
I have dataframe like this:
Product
Colour
Grade
Price
Size
Apple
Yellow
A
1000
3
Apple
Green
B
500
4
Banana
Yellow
B
2000
5
Banana
Green
A
3000
6
I want to convert the dataframe to:
Product
...
-2
votes
0
answers
42
views
ValueError: The truth value of a Series is ambiguous when running labelencoder
I am trying to build a function that will take a python data frame and check any column that is an object, then label encode and transform all the object that types and return a transformed data frame
...
2
votes
2
answers
77
views
Split a pandas dataframe column into multiple based on text values
I have a pandas dataframe with a column.
id text_col
1 Was it Accurate?: Yes\n\nReasoning: This is a sample : text
2 Was it Accurate?: Yes\n\nReasoning: This is a :sample 2 text
3 Was ...
0
votes
1
answer
43
views
Applying styles to Pandas multiindex, using all index levels for context
I am attempting to style a dataframe with cell colors based on categories provided via the index. Index levels 0 and 1 provide the fruit and part. I want every cell to be colored based on distinct ...
0
votes
3
answers
45
views
Transpose XLSX and send to database, using Pandas
I have a xlsx file that is structured in an unorthodox way. Simplified, it looks like this:
A
B
C
D
E
F
1
2
member_id
101
102
102
103
3
first_name
paul
john
george
ringo
4
last_name
mccartney
...
1
vote
2
answers
59
views
Complicated triple sum in pandas dataframe
I have a pandas dataframe that looks like
import pandas as pd
data = {
"Race_ID": [1,1,1,2,2,2,2,2,3,3,3,4,4,5,5,5,5,5,5],
"Student_ID": [3,5,4,1,2,3,4,5,4,3,7,2,3,9,10,2,3,6,...
0
votes
0
answers
36
views
Pandas interpolate on 2 missing values based on different columns and other specific filter function after groupby
After a groupby on a date column I would like to interpolate on 2 specific values based on different columns and also retrieve the value of another for which the sum of two columns is minimum ...
I ...
-4
votes
2
answers
33
views
Getting NameError for pandas dataframe
I have df1 with column 'col' & df2 with columns 'code' and 'id'. Column 'col' in df1 is mapped to 'code' column in df2. When I am running the below code:
def get_id_for_code(code):
try:
...