Skip to main content

All Questions

0 votes
1 answer
456 views

I got the following error: 'DataFrame' object has no attribute 'year'

picture of csv file containing raw data I am trying to plot a scatter graph using an online csv file i downloaded in inorder to get the linear regression. %matplotlib inline plt.scatter(df.year, df....
Jamilu's user avatar
  • 5
2 votes
1 answer
88 views

Complicated double sum using groupby in Pandas dataframe

I have a dataframe that looks like Race_ID Date Student_ID a b 1 1/1/2023 1 3 1 1 1/1/2023 2 2 2 1 1/1/...
Ishigami's user avatar
  • 580
0 votes
1 answer
54 views

Users' trip time over a particular period of time

The Geolife dataset is a GPS trajectories of users logged as they move. Thanks to Sina Dabiri for providing a repository of the preprocessed data. I work with his preprocessed data and created a ...
user avatar
1 vote
2 answers
186 views

Recency and Frequency segmentaion

I have generated recency and frequency output in csv format from my RFM model. I wanted to segment that output in this manner; 1) Recency R1 Between 181 and 360 days R2 Between 121 and 180 days R3 ...
adey27's user avatar
  • 469
1 vote
1 answer
119 views

Trying to return the row if sentence is present in pandas dataframe with index value

I have one dataframe. I'm implementing sentence transformers and returning one row based on the search query. For example search_string = "thor's weapon" search_vect = model.encode([...
Nithin Reddy's user avatar
1 vote
1 answer
3k views

How to decode LabelEncoder implemented column in pandas dataframe?

I'm having a dataset. Where I was practicing feature engineering by converting categorical objects to numbers, with the following lines of code: import pandas as pd import numpy as np from sklearn ...
Samar Pratap Singh's user avatar
1 vote
1 answer
247 views

How to detect suspicious error in a column of a dataset?

I was trying encoding of data in the dataset named as train.csv provided in this github repository. I used the following code to do so. import pandas as pd from sklearn import preprocessing df = pd....
Samar Pratap Singh's user avatar
3 votes
2 answers
618 views

How to encode a dataset having multiple datatypes?

I have a dataset like: e = pd.DataFrame({ 'col1': ['A', 'A', 'B', 'W', 'F', 'C'], 'col2': [2, 1, 9, 8, 7, 4], 'col3': [0, 1, 9, 4, 2, 3], 'col4': ['a', 'B', 'c', 'D', 'e', 'F'] }) ...
Samar Pratap Singh's user avatar
0 votes
0 answers
27 views

How to join two pandas data frame with bit difficult to handle data [duplicate]

I have 2 dataframes having values as: df1: df2: I want to do left join df1 with df2, on basis of office & year. But the office column seems to be need something like df2.Geography contains df1....
Akhan's user avatar
  • 425
0 votes
2 answers
4k views

How to call a function on pandas dataframe with multiple argument

I would like to define a function which will be applied to a dataframe whenever it will be called for a specific columns. I don't want to hard code the column names while defining the funtion. Below ...
dg S's user avatar
  • 85
0 votes
2 answers
63 views

Subtraction in Python dataframe but with a logic

I am trying to convert below input column to output column. ff = pd.DataFrame({'Input':[0,50,0,49,4,100,2,4,1,5,6,3,2], 'Output':[0,50,0,49,4,100,98,94,93,88,82,79,77]}) Logic:...
SupportVector's user avatar
0 votes
1 answer
116 views

choose random rows in pandas datafram

I have a dataframe like this; ID code 333_c_132 x 333_c_132 n06 333_c_132 n36 333_c_132 n60 333_c_132 n72 333_c_132 n84 333_c_132 n96 333_c_132 n108 333_c_132 n120 ...
Mass17's user avatar
  • 1,605
1 vote
1 answer
38 views

Split the list in large dataframe to columns in pandas

I have the following dataframe. 0 0 [121, Issued, 10112] 1 [121, Assigned, 10112] 2 [121, Completed, 10112] 3 [121, Issued, 10113] 4 [121, Completed, 10113] 5 [121, Assigned, 10113] 6 ...
user avatar
0 votes
1 answer
52 views

Building Pandas Dataframe from nested JSOn

I have JSON data in the following format - [ { "score": 0.9228411211686975, "keypoints": [ { "score": 0.9997879266738892, "part": "...
dipamchang's user avatar
4 votes
2 answers
2k views

How to encode a pandas.DataFrame column containing lists using Sklearn.preprocessing

I have a pandas df and some of the columns are lists with data in them and I would like to encode the labels within the lists. I get this error: ValueError: Expected 2D array, got 1D array instead: ...
raceee's user avatar
  • 517

15 30 50 per page