Let us understand the concept of flow control and congestion control.Flow controlIt is handled by a receiving side and it safeguards that a sender can only send something that a receiver can control or handle.Flow control handles a mechanism available to safeguard that communication flows smoothly.For example, a situation where somebody has a quick fiber connection could be sending on something or dial up similar. A sender could have the capability to send packets quickly, however that can be useless to a receiver on dialup. Thus they require a method to throttle the sending side.The issues related to flow control ... Read More
The Congestion at the network layer came across two issues which are throughput and delay.Based on DelayWhen compared to capacity of the network, if load is less, the delay is minimum.Here the minimum delay is composed of propagation delay and processing delay and both are negligible.Therefore, when load reaches the network capacity, the delay increases because we must add the queuing delay to the total delay.When the load is greater than the capacity the delay becomes infinite.Based on ThroughoutWhen load is below the capacity of the network, the throughput increases proportional to the load.After the load reaches the capacity, we ... Read More
The performance of a network can be measured in terms of Delay, Throughput and Packet loss.Let us try to understand the concept of Delay.DelayA packet from its source to its destination, encounters delays. The delays in a network can be divided into four types as follows −Transmission delayTransmission delay is the amount of time taken by the router to transfer the packet to the outgoing link is called transmission delay.For example, assume that you have 100 kb of data. For this data, you have to keep on this outgoing link and this is known as Transmission delay.Suppose you are vacating ... Read More
To merge Pandas DataFrame, use the merge() function. In that, you can set the parameter indicator to True or False. If you want to check which dataframe has a specific record, then use −indicator= TrueAs shown above, using above parameter as True, adds a column to the output DataFrame called “_merge”.At first, let us import the pandas library with an alias −import pandas as pd Let us create DataFrame1 −dataFrame1 = pd.DataFrame( { "Car": ['BMW', 'Lexus', 'Audi', 'Mustang', 'Bentley', 'Jaguar'], "Units": [100, 150, 110, 80, ... Read More
To calculate the standard deviation, use the std() method of the Pandas. At first, import the required Pandas library −import pandas as pdNow, create a DataFrame with two columns −dataFrame1 = pd.DataFrame( { "Car": ['BMW', 'Lexus', 'Audi', 'Tesla', 'Bentley', 'Jaguar'], "Units": [100, 150, 110, 80, 110, 90] } ) Finding the standard deviation of “Units” column value using std() −print"Standard Deviation of Units column from DataFrame1 = ", dataFrame1['Units'].std()In the same way, we have calculated the standard deviation from the 2nd DataFrame.ExampleFollowing is the complete code −# # Python - Calculate the ... Read More
To select final periods of time series based on a date offset, use the last() method. At first, set the date index with periods and freq. Freq is for frequency −i = pd.date_range('2021-07-15', periods=5, freq='3D')Now, create a DataFrame with above index −dataFrame = pd.DataFrame({'k': [1, 2, 3, 4, 5]}, index=i) Fetch rows from last 4 days i.e. 4D −dataFrame.last('4D')ExampleFollowing is the complete code −import pandas as pd # date index set with 5 periods and frequency of 3 days i = pd.date_range('2021-07-15', periods=5, freq='3D') # creating DataFrame with above index dataFrame = pd.DataFrame({'k': [1, 2, 3, 4, 5]}, ... Read More
To remove leading or trailing whitespace, use the strip() method. At first, create a DataFrame with 3 columns “Product Category”, “Product Name” and “Quantity” −dataFrame = pd.DataFrame({ 'Product Category': [' Computer', ' Mobile Phone', 'Electronics ', 'Appliances', ' Furniture', 'Stationery'], 'Product Name': ['Keyboard', 'Charger', ' SmartTV', 'Refrigerators', ' Chairs', 'Diaries'], 'Quantity': [10, 50, 10, 20, 25, 50]})Removing whitespace from more than one column −dataFrame['Product Category'].str.strip() dataFrame['Product Name'].str.strip()ExampleFollowing is the complete code −import pandas as pd # create a dataframe with 3 columns dataFrame = pd.DataFrame({ 'Product Category': [' Computer', ' Mobile Phone', 'Electronics ', 'Appliances', ... Read More
When it is required to convert a matrix into a string, a simple list comprehension along with the ‘join’ method is used.ExampleBelow is a demonstration of the samemy_list = [[1, 22, "python"], [22, "is", 1], ["great", 1, 91]] print("The list is :") print(my_list) my_list_1, my_list_2 = ", ", " " my_result = my_list_2.join([my_list_1.join([str(elem) for elem in sub]) for sub in my_list]) print("The result is :") print(my_result)OutputThe list is : [[1, 22, 'python'], [22, 'is', 1], ['great', 1, 91]] The result is : 1, 22, python 22, is, 1 great, 1, 91ExplanationA list of list is defined ... Read More
To compare specific timestamps, use the index number in the square brackets. At first, import the required library −import pandas as pdCreate a DataFrame with 3 columns. We have two date columns with timestamp −dataFrame = pd.DataFrame( { "Car": ["Audi", "Lexus", "Tesla", "Mercedes", "BMW"], "Date_of_Purchase": [ pd.Timestamp("2021-06-10"), pd.Timestamp("2021-07-11"), pd.Timestamp("2021-06-25"), pd.Timestamp("2021-06-29"), pd.Timestamp("2021-03-20"), ], "Date_of_Service": [ pd.Timestamp("2021-11-05"), pd.Timestamp("2021-12-03"), ... Read More
When it is required to replace list elements within a range with a given number, list slicing is used.ExampleBelow is a demonstration of the samemy_list = [42, 42, 18, 73, 11, 28, 29, 0, 10, 16, 22, 53, 41] print("The list is :") print(my_list) i, j = 4, 8 my_key = 9 my_list[i:j] = [my_key] * (j - i) print("The result is:") print(my_list)OutputThe list is : [42, 42, 18, 73, 11, 28, 29, 0, 10, 16, 22, 53, 41] The result is: [42, 42, 18, 73, 9, 9, 9, 9, 10, 16, 22, 53, 41]ExplanationA list ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP