2

I have to work with prepared Excel file, all of the columns are "General".

I want to filter data using pandas, what I did is that I made all of the columns to str(), and everything works fine except column with dates.

As I said all of the columns are "General", so dates in this file are just text in format dd/mm/yyyy, and it wouldn't be a problem for me to filter it as string(I need to find one date each searching), but when I read it with pandas I receive what is in cell embedded with question marks("?dd/mm/yyyy?"). I converted it into b'' and I got b'\xe2\x80\xad14/06/1919\xe2\x80\xac'. I found what this code points mean: https://www.utf8-chartable.de/unicode-utf8-table.pl?start=8192&number=128&utf8=string-literal, but still doesn't know what to do with this. Pandas recognizes this column as "dtype: object". What should I do to filter this column properly?

import pandas as pd

data = pd.read_excel('http://[::1]:8000/FileName.xlsx')
data["Date"] = data["Date"].apply(str)
result_data = data[(data["Date"]==my_date])]
Logica
  • 977
  • 4
  • 16
Ala Cris
  • 41
  • 1
  • 5

1 Answers1

0

I found solution here.

In my case:

data["Date"] = data["Date"].str.encode('ascii', 'ignore').str.decode('ascii')
Ala Cris
  • 41
  • 1
  • 5