yhat / pandasql

sqldf for pandas
MIT License
1.33k stars 185 forks source link

Add a user defined regexp function when initialising sqlite connection #58

Open andreaslang opened 7 years ago

andreaslang commented 7 years ago

Hi, I realised that by default I could not use the REGEXP keyword/function of sqlite because it requires a user-defined function to work. This patch solves the problem and allows to do:

pysqldf("""
    SELECT count(*) 
    FROM tweets
        WHERE NOT date REGEXP '^[0-9]{4}-[0-9]{2}-[0-9]{2}'
    LIMIT 10
""") 

It's a fairly simple patch, let me know what you think or if it requires any changes.

javadba commented 5 years ago

Do you have a fork that includes this (and possibly other fixes)? This project is approaching abandonware status it seems.