Tuesday, 18 June 2019

Excel read, Two days different in Python

Program:

import pandas as pd
df = pd.read_excel('CompleteData2.xlsx', sheet_name='Test')
df.DOA = pd.to_datetime(df['DOA']).dt.normalize()
df.DOD = pd.to_datetime(df['DOD']).dt.normalize()
df['Length_of_stay'] =  ((df['DOD'] - df['DOA'])).dt.days
f = df.loc[:,['Length_of_stay']] 
mode = f.mode(axis=0)
print(mode, 'Mode of Length_of_stay')
mean = f.mean(axis=0)
print(mean, 'Mean of Length_of_stay')

output:


Saturday, 1 June 2019

View a List of Databases on an Instance of SQL Server

Query 1:


SELECT name, database_id, create_date  FROM sys.databases ;


If u need only the User-defined databases;



Query 1: select * from sys.databases WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb');


Query 2: SELECT name,filename ,sid FROM dbo.sysdatabases  WHERE dbid > 4

Bulk SMS Sender ID Codes

Bulk SMS Sender ID Codes Following table is of Telecom Operator Code. Provider Code Airtel A BSNL B Datacom Solu...