Server Side Programming Articles - Page 1478 of 2650

How to process excel files data in chunks with Python?

Kiran P
Updated on 09-Nov-2020 10:18:17

3K+ Views

IntroductionIt seems that the world is ruled by Excel. I've been surprised in my data engineering work to see how many of my colleagues are using Excel as a critical tool for making decisions. While I'm not a big fan of MS Office and their excel spread sheets, i will still show you a neat trick to handle large excel spread sheets effectively.How to do it..Before we jump into the program directly, let us understand few basics on dealing excel spreadsheets with Pandas.1. Installation. Go ahead and install openpyxl and xlwt. If you are unsure if it is installed or ... Read More

How to implement immutable Data structures in Python?

Kiran P
Updated on 09-Nov-2020 10:16:00

326 Views

ProblemYou need to implement immutable data structures in Python.Introduction..Immutable data structures are very handy when you want to prevent multiple people modifying a piece of data in parallel programming at same time. Mutable data structures( e.g. Array) can be changed at any time while immutable data structures cannot be.How to do it..Let me show you step by step how to deal with immutable and mutable data structures.Example# STEP 01 - Create a Mutable array. # Define an array atp_players = ['Murray', 'Nadal', 'Djokovic'] print(f" *** Original Data in my array is - {atp_players}")*** Original Data in my array is ... Read More

How to Compress files with ZIPFILE module in Python.

Kiran P
Updated on 09-Nov-2020 10:12:31

12K+ Views

ProblemYou want to create a compress files in python.IntroductionZIP files can hold the compressed contents of many other files. Compressing a file reduces its size on disk, which is useful when transferring it over the internet or between the systems using Control-m AFT or Connect direct or even scp.Python programs creates ZIP files using functions in the zipfile module.How to do it...1. We will be using zipfile and io packages. Install them with pip if any of the packages are missing on your system. If you are unsure, use pip freeze command to validate the packages.2. We will write a ... Read More

How to append new rows to DataFrame using a Template In Python Pandas

Kiran P
Updated on 09-Nov-2020 10:07:27

693 Views

How to append new rows to DataFrame using a Template In Python Pandas.IntroductionBeing a data engineering specialist, i often end up creating more derived columns than rows as the role of creating and sending the data to me for analysis should be taken care of other database specialists. However, it is not true during all time.We have to create sample rows rather than waiting for data specialists team to send us the data. In this topic i will be showing the neat tricks for creating rows.How to do it..In this recipe, we will begin by appending rows to a small ... Read More

How to Parse HTML pages to fetch HTML tables with Python?

Kiran P
Updated on 09-Nov-2020 10:04:02

842 Views

ProblemYou need to extract the HTML tables from a web page.IntroductionThe internet, and the World Wide Web (WWW), is the most prominent source of information today. There is so much information out there, it is just very hard to choose the content from so many options. Most of that information is retrievable through HTTP.But we can also perform these operations programmatically to retrieve and process information automatically.Python allows us to do this using its standard library an HTTP client, but the requests module helps in obtaining web pages information very easy.In this post, we will see how to parse through ... Read More

How to resize an Image C#?

Nizamuddin Siddiqui
Updated on 07-Nov-2020 12:14:52

593 Views

A bitmap consists of the pixel data for a graphics image and its attributes. There are many standard formats for saving a bitmap to a file. GDI+ supports the following file formats: BMP, GIF, EXIF, JPG, PNG and TIFF. You can create images from files, streams, and other sources by using one of the Bitmap constructors and save them to a stream or to the file system with the Save method.In the below code CompressAndSaveImageAsync Method Compresses the images and saves in the path Mentioned.The new image name will be a combination of desktop userId and dateTimeExampleprivate async Task CompressAndSaveImageAsync(Bitmap ... Read More

How can I limit Parallel.ForEach in C#?

Nizamuddin Siddiqui
Updated on 07-Nov-2020 12:12:44

2K+ Views

Parallel ForeachParallel.ForEach loop in C# runs upon multiple threads and processing takes place in a parallel way. Parallel.ForEach loop is not a basic feature of C# and it is available from C# 4.0 and above To use Parallel.ForEach loop we need to import System.Threading.Tasks namespace in using directive.ForeachForeach loop in C# runs upon a single thread and processing takes place sequentially one by one. Foreach loop is a basic feature of C# and it is available from C# 1.0. Its execution is slower than the Parallel.Foreach in most of the cases.Example 1static void Main(string[] args){    List alphabets = new ... Read More

How to determine if C# .NET Core is installed?

Nizamuddin Siddiqui
Updated on 07-Nov-2020 12:22:15

3K+ Views

The following options are for dotnet by itself. For example, dotnet −−info. They print out information about the environment if not installed it will throw error.−−infoPrints out detailed information about a .NET Core installation and the machine environment, such as the current operating system, and commit SHA of the .NET Core version.−−versionPrints out the version of the .NET Core SDK in use.−−list−runtimesPrints out a list of the installed .NET Core runtimes. An x86 version of the SDK lists only x86 runtimes, and an x64 version of the SDK lists only x64 runtimes.−−list−−sdksPrints out a list of the installed .NET Core ... Read More

What is the best way to convert seconds into (Hour:Minutes:Seconds:Milliseconds) time in C#?

Nizamuddin Siddiqui
Updated on 07-Nov-2020 12:04:17

5K+ Views

DateTimeDateTime is a structure of value Type like int, double etc. It is available in System namespace and present in mscorlib.dll assembly.It implements interfaces like IComparable, IFormattable, IConvertible, ISerializable, IComparable, IEquatable.DateTime contains properties like Day, Month, Year, Hour, Minute, Second, DayOfWeek and others in a DateTime object.TimeSpanTimeSpan struct represents a time interval that is difference between two times measured in number of days, hours, minutes, and seconds.TimeSpan is used to compare two DateTime objects to find the difference between two dates. TimeSpan class provides FromDays, FromHours, FromMinutes, FromSeconds, and FromMilliseconds methods to create TimeSpan objects from days, hours, minutes, seconds, ... Read More

How to easily initialize a list of Tuples in C#?

Nizamuddin Siddiqui
Updated on 07-Nov-2020 12:03:01

4K+ Views

Tuple can be used where you want to have a data structure to hold an object with properties, but you don't want to create a separate type for it. The Tuple class was introduced in .NET Framework 4.0. A tuple is a data structure that contains a sequence of elements of different data types.Tuple person = new Tuple (1, "Test", "Test1");A tuple can only include a maximum of eight elements. It gives a compiler error when you try to include more than eight elements.Tuples of Listvar tupleList = new List {    (1, "cow1"),    (5, "chickens1"),    (1, "airplane1") ... Read More

Advertisements