Merry Christmas :) !!!


Untitled This is a quick script on how to save Python pivot_table in an excel file. Credit to pbpython In [1]:
|
1 2 3 4 |
import sqlalchemy import pyodbc from pandas import DataFrame import pandas as pd |
In [2]:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
df = DataFrame ## connect to SqlServer Database and get information. try: import urllib params = urllib.quote_plus("DRIVER={SQL Server Native Client 11.0};SERVER=.\MSSQLSERVER_ENT;DATABASE=Antrak;Trusted_Connection=yes;") engine = sqlalchemy.create_engine('mssql+pyodbc:///?odbc_connect=%s"' % params) resoverall = engine.execute("SELECT * FROM FlightBookingsMain") df = df(resoverall.fetchall()) df.columns = resoverall.keys() except (RuntimeError, TypeError, NameError): print('Error in Conneccting') print(RuntimeError, TypeError, NameError) finally: print("connected") |
|
1 |
connected |
In [8]:
|
1 |
df.head() |
Out[8]: First Name Last Name Sex Phone Fax Email Address Booking Date Departure Date Arrival Date Address1 … Number of Passengers Total Cost Currency Numeric Code…
Happy Weekend To You All From The DataPandas Team 🙂 Want more information like this?
Sometimes, you might need some packages which do not come with the standard Python libraries and you would want to install them separately. You will notice how frustrating it is when you get stuck because of a package you are missing. Sentdex on Youtube covers that accurately and you can watch him here: …
Summarizing Data This week we are looking at five most common aggregate functions used to summarize information stored in tables: COUNT and SUM very frequently. COUNT is the only aggregate function that can work on any type of variable. The other four aggregate functions are only appropriate for numerical data. All aggregate functions require you…
DataPandas wishes you Happy International Workers’ Day! Want more information like this?
This is a guide on Python List comprehension. List comprehension is a great way to write simple and easy to read Python codes. You can use it dictionaries and sets as well. Credits to Corey Schafer , creator of Python course materials. lets create a list In [115]:
|
1 2 |
num = range(10) num |
Out[115]:
|
1 |
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
lets grab all the…
An experienced DevOps and Cloud Training Company to meet your DevOps and Cloud needs
You can see how this popup was set up in our step-by-step guide: https://wppopupmaker.com/guides/auto-opening-announcement-popups/