
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

489 Views
Swarm Plot in Seaborn is used to draw a categorical scatterplot with non-overlapping points. The seaborn.swarmplot() is used for this.Let’s say the following is our dataset in the form of a CSV file − Cricketers.csvAt first, import the required 3 libraries −import seaborn as sb import pandas as pd import matplotlib.pyplot as pltLoad data from a CSV file into a Pandas DataFrame −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers.csv") Plotting swarm plot with Age and Height (inches) −sb.swarmplot(x = dataFrame["Age"], y = dataFrame["Height"], data=dataFrame)ExampleFollowing is the code −import seaborn as sb import pandas as pd import matplotlib.pyplot as plt # Load data from ... Read More

312 Views
To name columns explicitly, use the names parameter of the read_csv() method. Let’s say the following is our CSV file without headers opened in Microsoft Excel −Let us load data from CSV file and with that add header columns using the names parameter −pd.read_csv("C:\Users\amit_\Desktop\TeamData.csv", names=['Team', 'Rank_Points', 'Year'])ExampleFollowing is the complete code −import pandas as pd # Load data from a CSV file into a Pandas DataFrame dataFrame = pd.read_csv("C:\Users\amit_\Desktop\TeamData.csv") print("Reading the CSV file without headers...", dataFrame) # adding headers dataFrame = pd.read_csv("C:\Users\amit_\Desktop\TeamData.csv", names=['Team', 'Rank_Points', 'Year']) # reading updated CSV print("Reading the CSV file after updating headers...", dataFrame)OutputThis ... Read More

381 Views
Horizontal trend is also called Stationery trend. Let’s say the following is our dataset i.e. SalesRecords3.csvAt first, import the required libraries −import pandas as pd import matplotlib.pyplot as pltLoad data from a CSV file into a Pandas DataFrame −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\SalesRecords3.csv") Casting column to datetime object −dataFrame['Sold_On'] = pd.to_datetime(dataFrame['Sold_On'])Create the plot for downtrend −dataFrame.plot() ExampleFollowing is the code −import pandas as pd import matplotlib.pyplot as plt # Load data from a CSV file into a Pandas DataFrame dataFrame = pd.read_csv("C:\Users\amit_\Desktop\SalesRecords3.csv") print("Reading the CSV file...", dataFrame) # casting column to datetime object dataFrame['Sold_On'] = pd.to_datetime(dataFrame['Sold_On']) dataFrame = dataFrame.set_index('Sold_On') ... Read More

665 Views
Violin Plot in Seaborn is used to draw a combination of boxplot and kernel density estimate. The seaborn.violinplot() is used for this.Let’s say the following is our dataset in the form of a CSV file − Cricketers.csvAt first, import the required 3 libraries −import seaborn as sb import pandas as pd import matplotlib.pyplot as pltLoad data from a CSV file into a Pandas DataFrame −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers.csv") Plotting violin plot with column Weight (kgs) −sb.violinplot(dataFrame['Weight'])ExampleLet us see an example −import seaborn as sb import pandas as pd import matplotlib.pyplot as plt # Load data from a CSV file into ... Read More

2K+ Views
For a stacked Horizontal Bar Chart, create a Bar Chart using the barh() and set the parameter “stacked” as True −Stacked = TrueAt first, import the required libraries −import pandas as pd import matplotlib.pyplot as pltCreate a DataFrame with 3 columns −dataFrame = pd.DataFrame({"Car": ['Bentley', 'Lexus', 'BMW', 'Mustang', 'Mercedes', 'Jaguar'], "Cubic_Capacity": [2000, 1800, 1500, 2500, 2200, 3000], "Reg_Price": [7000, 1500, 5000, 8000, 9000, 6000], })Plotting stacked Horizontal Bar Chart with all the columns −dataFrame.plot.barh(stacked=True, title='Car Specifications', color=("orange", "cyan")) ExampleFollowing is the complete code −import pandas as pd import matplotlib.pyplot as plt # creating dataframe dataFrame = pd.DataFrame({"Car": ['Bentley', 'Lexus', ... Read More

476 Views
The eval() function can also be used to evaluate the sum of rows with the specified columns. At first, let us create a DataFrame with Product records −dataFrame = pd.DataFrame({"Product": ["SmartTV", "ChromeCast", "Speaker", "Earphone"], "Opening_Stock": [300, 700, 1200, 1500], "Closing_Stock": [200, 500, 1000, 900]})Finding sum using eval(). The resultant column with the sum is also mentioned in the eval(). The expression displays the sum formulae assigned to the resultant column −dataFrame = dataFrame.eval('Result_Sum = Opening_Stock + Closing_Stock')ExampleFollowing is the complete code −import pandas as pd dataFrame = pd.DataFrame({"Product": ["SmartTV", "ChromeCast", "Speaker", "Earphone"], "Opening_Stock": [300, 700, 1200, 1500], "Closing_Stock": [200, ... Read More

2K+ Views
Box Plot in Seaborn is used to draw a box plot to show distributions with respect to categories. The seaborn.boxplot() is used for this.Let’s say the following is our dataset in the form of a CSV file − Cricketers.csvAt first, import the required 3 libraries −import seaborn as sb import pandas as pd import matplotlib.pyplot as pltLoad data from a CSV file into a Pandas DataFrame −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers.csv") ExampleFollowing is the code −import seaborn as sb import pandas as pd import matplotlib.pyplot as plt # Load data from a CSV file into a Pandas DataFrame: dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers.csv") ... Read More

2K+ Views
SactterPlot in Seaborn is used to draw a scatter plot with possibility of several semantic groupings. The seaborn.scatterplot() is used for this.Let’s say the following is our dataset in the form of a CSV file − Cricketers.csvAt first, import the required 3 libraries −import seaborn as sb import pandas as pd import matplotlib.pyplot as pltLoad data from a CSV file into a Pandas DataFrame −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers.csv") Plotting scatterplot with Age and Weight (kgs). The hue parameter set as "Role" −sb.scatterplot(dataFrame['Age'], dataFrame['Weight'], hue=dataFrame['Role'])ExampleFollowing is the code −import seaborn as sb import pandas as pd import matplotlib.pyplot as plt # ... Read More

731 Views
Lineplot in Seaborn is used to draw a line plot with possibility of several semantic groupings. The seaborn.lineplot() is used for this.Let’s say the following is our dataset in the form of a CSV file − Cricketers.csvAt first, import the required 3 libraries −import seaborn as sb import pandas as pd import matplotlib.pyplot as pltLoad data from a CSV file into a Pandas DataFrame −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers.csv") ExampleFollowing is the code − import seaborn as sb import pandas as pd import matplotlib.pyplot as plt # Load data from a CSV file into a Pandas DataFrame dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers.csv") print("Reading ... Read More

196 Views
Bar Plot in Seaborn is used to show point estimates and confidence intervals as rectangular bars. The seaborn.barplot() is used. Control ordering by passing an explicit order i.e. ordering on the basis of a specific column using the order parameter.Let’s say the following is our dataset in the form of a CSV file −Cricketers2.csvAt first, import the required libraries −import seaborn as sb import pandas as pd import matplotlib.pyplot as pltLoad data from a CSV file into a Pandas DataFrame −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers2.csv") Plotting horizontal bar plots with Matches and Academy columns. Control order by passing an explicit order i.e. ... Read More