Skip to content

Tag: python

python list in tuple compare

I have a list and a tuple ( from sqlite query) and what to check if the items in list are not in the db tuple. If not add to newJobs list links = [“example.com”, “mysite.com”] …

datetime.datetime conversion to datetime

I have defined a column in SQL Server as ldate with datetime data type and accepting null values. I’m trying to send data from my local machine using python and pyodbc. I have date like 20-01-2015 in string format. When I try to send data it throws an error: pyodbc.DataError: (‘22007’, &#821…

How to add a ranking to a pyspark dataframe

I have a pyspark dataframe with 2 columns – id and count. I want to add a ranking to this by reverse count. So the highest count has rank 1, second highest rank 2, etc. testDF = spark.createDataFrame([(DJS232,437232)], [“id”, “count”]) I first tried using and this worked, ish. It…

How Can My sqllite3 interaction be fixed?

I’m trying to get an admin account to edit a ‘rank’ (basically access level) for one of the profiles in my data-base. The error is: The code that seems to be the problem is: Originally, it was all on one line and it didn’t work, and now I’ve tried it on multiple lines and it stil…

How to connect to a Azure SQL Server through Python

I’ve come across some trouble accessing my SQL Server through Python. I can get it going when my SQL Server is installed locally, but not when it is online. I have used the following code: Connection to SQL Server but then when I try and run: I get the error: InterfaceError: (‘IM002’, &#8216…