Skip to main content

All Questions

Tagged with
0 votes
1 answer
44 views

Filter datetime column with object as data type in python

I have a df with a Timestamp and Value columns. Both have the 'object' dtype | Timestamp | Value | -------------------------------------- | 8/21/2023 12:00:00 AM | a | | 11/...
aditya tandel's user avatar
0 votes
1 answer
45 views

How to write a function to read csv files with different separators in pandas in Python?

I have a bunch of CSV files for different years named my_file_2019, my_file_2020, my_file_2023 and so on. Some files have tab separator while others have semi-colon. I want to write a common function ...
hbstha123's user avatar
  • 1,456
2 votes
4 answers
92 views

Filter DataFrame events not in time windows DataFrame

I have a DataFrame of events (Event Name - Time) and a DataFrame of time windows (Start Time - End Time). I want to get a DataFrame containing only the events not in any of the time windows. I am ...
Yakir Shlezinger's user avatar
0 votes
2 answers
37 views

Pandas - Filter - TypeError: 'in <string>' requires string as left operand, not list

I am exploring Pandas filter and while doing so I came across this error while using the below query df2.filter(like = ['Republic','United'], axis=0 ) How do I provide a list in Like parameter in ...
srijan bansal's user avatar
0 votes
1 answer
88 views

Python filtering and extract text

I am pretty new to coding and lately I chanced upon something which I wanted to try solving with Python. Below is the text content of which I wanted to query, extract certain fields into a new file. ...
John Teo's user avatar
0 votes
0 answers
53 views

Pandas filtering yields null values

I have a df which I am filtering based on a particular column. This is my code to do that test_table[(test_table['Item']=='1')] Ideally this code should return the rows where the value of column '...
AnonymousMe's user avatar
3 votes
1 answer
55 views

How to filter dataframe column names containing 2 specified substrings?

I need the column names from the dataframe that contain both the term software and packages. I'm able to filter out columns containing one string.. for eg: software_cols = df.filter(regex='Software|...
say_n's user avatar
  • 45
0 votes
1 answer
50 views

filter result of groupby with pd.Series of boolean

Consider having two dataframes having the same column a. However in the first dataframe column a has unique values, whereas in the second one it does not although the possible values of column are the ...
roschach's user avatar
  • 9,044
1 vote
1 answer
53 views

Finding back-to-back dates using Python

I have an NBA Dataset that looks like: Player Game_date Lebron James 2023-10-11 Lebron James 2023-10-12 Lebron James 2023-10-18 Kobe Bryant 2023-11-02 Kobe Bryant 2023-11-03 Kobe Bryant 2023-11-...
Sam Ash's user avatar
  • 13
0 votes
1 answer
48 views

Filter multiple dataframes and create a new one from the results

I'm a researcher and I would like to filter 2 dataframes and create a new dataframe where it shares common filtered results of the two. I have used a for-loop for the filter criteria for reference but ...
Borla312's user avatar
-1 votes
1 answer
65 views

Panda Data Frame Filtering Tkinter

So I'm building an APP to analyze stock excels i download using wep scrapping. I builded a treeview table with pandas data frame uploading the excel to the data frame. So currently i have a data frame ...
Alejandro Ferrer's user avatar
1 vote
1 answer
96 views

Conversion error when using to_datetime to convert mixed date formats in large CSV database

I have a big csv database of contracts (25 mln lines and around 7 gb). I need to filter it out expired contracts to reduce the size for further calculations. The array of expiration dates contains ...
Malicious Bread Boy's user avatar
0 votes
0 answers
51 views

One of the columns is not showing the miliseconds after I filter the data

I'm using pandas 2.1.3 library, on python 3.11, to read an .xlsx file, that .xlsx file has 4 timestamp columns: 'FN_CTime', 'FN_ATime', 'FN_MTime', 'FN_RTime', all four using the same format in excel: ...
Kuritsu's user avatar
0 votes
2 answers
34 views

Only keep columns in a dataframe that include a certain string in one of the rows

I have about 50 columns and only want to keep columns in a dataframe that include a colon (:) in one of the rows. Example data: DATE CALL_ID TALK_TIME SPEED_OF_ANSWER CONSULT_TIME 0 ...
Bama's user avatar
  • 11
2 votes
2 answers
87 views

Filter pandas dataframe for rows with a specific date

I am new to python (I have used R in the past). I have a pandas data frame with one column containing dates. I would like to filter for observations occurring on one specific date. ## Create the ...
Kelsey Butler's user avatar

15 30 50 per page
1
2 3 4 5
72