Python Forum
Need Help With Filtering Data For Excel Files Using Pandas
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need Help With Filtering Data For Excel Files Using Pandas
#3
Many thanks for reply scidam, I changed my Code to the following, and the Data is almost displaying How I want :-

import pandas as pd
 
data = pd.read_excel (r'C:\Users\Edward\Desktop\BBMF Schedules And Master Forum Thread Texts\BBMF Display Schedule 2009.xls')
 
df = pd.DataFrame(data, columns= ['Venue','A/C','DISPLAY/','Date'])
 
df[(df['Venue'].str.contains('[a-zA-Z]') & (df['DISPLAY/'].str.contains('DISPLAY') & df['A/C'].str.contains("DHS|DAK|HS")) & (df['A/C'] != 'LHS') & (df['A/C'] != 'LANC'))]
How do I Code, so that only the rows show for DAK and HS, where the Venue is the same above and below, i.e. Two KEMBLE one Above and below, when one One row in the A/C Column says DAK and the row below or above says HS, normally below. Ideally I would like to change, DAK and HS to DHS and only one Venue row, i.e. not two KEMBLES just one in one Row. Any Ideas ?
Reply


Messages In This Thread
RE: Need Help With Filtering Data For Excel Files Using Pandas - by eddywinch82 - Aug-02-2019, 04:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Parsing "aTimeLogger" Android app data to graphs using pandas Drone4four 6 592 Jun-02-2024, 11:12 AM
Last Post: Drone4four
  Pandas keep existing format of Excel AlphaInc 2 1,591 Jan-11-2024, 03:44 AM
Last Post: plonkarchivist
  Grouping in pandas/multi-index data frame Aleqsie 3 838 Jan-06-2024, 03:55 PM
Last Post: deanhystad
  Filtering Data Frame, with another value NewBiee 9 1,604 Aug-21-2023, 10:53 AM
Last Post: NewBiee
  Data Sorting and filtering(From an Excel File) PY_ALM 0 1,123 Jan-09-2023, 08:14 PM
Last Post: PY_ALM
Smile How to further boost the data read write speed using pandas tjk9501 1 1,332 Nov-14-2022, 01:46 PM
Last Post: jefsummers
  Pandas Dataframe Filtering based on rows mvdlm 0 1,523 Apr-02-2022, 06:39 PM
Last Post: mvdlm
Thumbs Up can't access data from URL in pandas/jupyter notebook aaanoushka 1 1,940 Feb-13-2022, 01:19 PM
Last Post: jefsummers
  Help with poorly formatted excel data armitron121 1 1,783 Jan-13-2022, 07:31 AM
Last Post: paul18fr
Question Sorting data with pandas TheZaind 4 2,449 Nov-22-2021, 07:33 PM
Last Post: aserian

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020