To count distinct, use nunique in Pandas. We will groupby a column and find sun as well using Numpy sum().At first, import the required libraries −import pandas as pd import numpy as npCreate a DataFrame with 3 columns. The columns have duplicate values −dataFrame = pd.DataFrame( { "Car": ['BMW', 'Audi', 'BMW', 'Lexus', 'Lexus'], "Place": ['Delhi', 'Bangalore', 'Delhi', 'Chandigarh', 'Chandigarh'], "Units": [100, 150, 50, 110, 90] } )Count distinct in aggregation agg() with nunique. Calculating the sum for counting, we are using numpy sum() −dataFrame = dataFrame.groupby("Car").agg({"Units": np.sum, "Place": pd.Series.nunique})ExampleFollowing is the code −import ... Read More
To remove duplicate values from a Pandas DataFrame, use the drop_duplicates() method. At first, create a DataFrame with 3 columns −dataFrame = pd.DataFrame({'Car': ['BMW', 'Mercedes', 'Lamborghini', 'BMW', 'Mercedes', 'Porsche'], 'Place': ['Delhi', 'Hyderabad', 'Chandigarh', 'Delhi', 'Hyderabad', 'Mumbai'], 'UnitsSold': [95, 70, 80, 95, 70, 90]})Remove duplicate values −dataFrame = dataFrame.drop_duplicates() ExampleFollowing is the complete code −import pandas as pd # Create DataFrame dataFrame = pd.DataFrame({'Car': ['BMW', 'Mercedes', 'Lamborghini', 'BMW', 'Mercedes', 'Porsche'], 'Place': ['Delhi', 'Hyderabad', 'Chandigarh', 'Delhi', 'Hyderabad', 'Mumbai'], 'UnitsSold': [95, 70, 80, 95, 70, 90]}) print"Dataframe...", dataFrame # counting frequency of column Car count = dataFrame['Car'].value_counts() print"Count in column ... Read More
We will consider an example of Car Sale Records and group month-wise to calculate the sum of Registration Price of car monthly. To sum, we use the sum() method.At first, let’s say the following is our Pandas DataFrame with three columns −dataFrame = pd.DataFrame( { "Car": ["Audi", "Lexus", "Tesla", "Mercedes", "BMW", "Toyota", "Nissan", "Bentley", "Mustang"], "Date_of_Purchase": [ pd.Timestamp("2021-06-10"), pd.Timestamp("2021-07-11"), pd.Timestamp("2021-06-25"), ... Read More
Let us understand what an ultra-dense network is.Ultra-Dense NetworkThe dense networks deliver the best of the user experience to the users. This type of network allows the users to get the best result by the use of the densification. The density here can be the absolute or relative density in the networks.The user density networks increase the density too potentially beyond its range to fulfill the customer demand. In the user defined network, the capacity grows as the capacity of the base station also increases. This type of network provides users with the best of experience with the densification approach.In ... Read More
In the OSI (Open System Interconnection) model, the transport layer is one of the seven layers and it is responsible for the end to end communication between the sender and receiver over the internet. It provides logical communication between the sender and receiver and ensures the end to end delivery of the packet.The transport layer main protocols are as follows −TCP (Transmission Control Protocol)UDP (User Datagram Protocol)SCTP (Stream Control Transmission Protocol)RDP (Reliable Data Protocol)RUDP (Reliable User Datagram Protocol)Responsibilities of the transport layerThe responsibilities of the transport layer are as follows −It provides a process to process delivery or end to ... Read More
BGP stands for Border gateway protocol. It is used to exchange the routing information between the networks. It makes the internet work. It always selects the local path preference. Because of the below reasons it is choosing the path than the best path.- Firstly RIP (Routing Information Protocol) selects the path with lowest hop count.- OSPF (Open Shortest Path First) selects the path with the lowest cost. This is more important.- The best path in internet depends on how we are forwarding the traffic and to which autonomous system instead of the shortest path.- Higher local preference path is preferred.-Shortest ... Read More
The basic building blocks of the IPsec vpn tunnelling are as follows −Authentication header − it is used to verify the identity of the sender of the data and to check whether it is altered or not. It ties data in every data packet to a verifiable signature. It is used for the purpose of authentication.Encapsulating security payload − the data in the data packet is scrambled by using the encryption technique to prevent the sniffing attacks. It ensures the confidentiality of the data as the data is encrypted and not being able to be understood by anyone except the ... Read More
The network troubleshooting tools are classified into two types −Hardware toolsThe hardware tools included in the network troubleshooting are explained below −Cable testerIt is also known as a media tester. It is used to test whether the cable works properly or not. The cable testers will confirm whether a cable works correctly and if there is a problem with the cable. Tools which are used for testing of the cable can be classified as a cable tester.Protocol analyserThis tool is used to analyse the network protocols like UDP, TCP, and FTP etc. This acts as a software as well as ... Read More
4G cellular network is actually the fourth generation of cellular communications.Features of 4GIt comes up with many features which are given below −10x high speed as compared to 3GThe cost is also less for each bit used.It is highly secured too.It comes up with LTE i.e. Long term evaluation which refers to high-speed data connection for mobile devices.Now let us talk about the security features of 4G.Security features of the 4G cellular networkSecurity features are the different types of security measures a 4G network possesses such as the following −Configuration of security − It is the most beautiful feature of ... Read More
To generate dates in a range, use the date _range() method. At first, import the required pandas library with an alias −import pandas as pdNow, let’s say you need to generate dates in arrange, therefore for this, mention the date from where you want to begin. Here, we have mentioned 1st June 2021 and period of 60 days −dates = pd.date_range('6/1/2021', periods=60) ExampleFollowing is the complete code − import pandas as pd # generate dates in a range # period is 60 i.e. 60 days from 1st June 2021 dates = pd.date_range('6/1/2021', periods=60) print"Displaying dates in a range...", ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP