Lab 03
Lab 03
Lab 03
Matplotlib,
seaborn
Task no. 1:
Create a Dictionary and convert them into data frames also check its datatype
Data Frames:
Data structure also contains labeled axes (rows and columns). Arithmetic operations align on
both row and column labels. Can be thought of as a dict-like container for Series objects. The
primary pandas data structure.
Task no. 2:
Describe():The describe() method is used for calculating some statistical data like percentile,
mean and std of the numerical values of the Series or DataFrame. It analyzes both numeric
and object series and also the DataFrame column sets of mixed data types.
Task no. 3:
Head():
head() returns the first n rows(observe the index values). The default number of elements to
display is five, but you may pass a custom number.
Task no. 4:
Tail(): tail() returns the last n rows(observe the index values). The default number of
elements to display is five, but you may pass a custom number.
Task no. 5:
Info():
The info() function is used to print a concise summary of a DataFrame. This method prints
information about a DataFrame including the index dtype and column dtypes, non-null values
and memory usage. Whether to print the full summary
Task no. 6:
Data.to_csv:
Pandas DataFrame to_csv() function converts DataFrame into CSV data. We can pass a file
object to write the CSV data into a file. Otherwise, the CSV data is returned in the string
format.
CSV File:
Task no. 7:
Remove the indexes from the csv file
If we want to convert this DataFrame to a CSV file without the index column, we can do it
by setting the index to be False in the to_csv() function. As seen in the output, the DataFrame
does have an index, but since we set the index parameter to False , the exported CSV file
won't have that extra column.
CSV File:
Task no. 8:
Read from CSV File
read_csv is an important pandas function to read csv files and do operations on it.
Task no. 9:
DataFrame.columns
The column labels of the DataFrame.
DataFrame.index
The index (row labels) of the DataFrame.
Create a series of 50 random numbers and check their data type and shape
Series is a one-dimensional labeled array capable of holding data of any type (integer, string,
float, python objects, etc.). The axis labels are collectively called index.
Task no. 15:
Find the minimum maximum and mean values column wise in a dataset
Convert the dataset into numpy array and also take transpose of it
Task no. 19:
Loc:
loc is label-based, which means that you have to specify rows and columns based on their row
and column labels.
Task no. 24:
Import matplotlib
Plot():
With Pyplot, you can use the xlabel() and ylabel() functions to set a label for the x- and y-axis.
With Pyplot, you can use the title() function to set a title for the plot.
Task no. 28:
You can use the keyword argument linestyle, or shorter ls, to change the style of the plotted
line
You can use the keyword argument linewidth or the shorter lw to change the width of the line
Task no. 30:
With the subplots() function you can draw multiple plots in one figure
Task no. 31:
If you want the bars to be displayed horizontally instead of vertically, use the barh() function
Task no. 33:
The scatter() function plots one dot for each observation. It needs two arrays of the same
length, one for the values of the x-axis, and one for values on the y-axis
Task no. 34:
Plot a histogram
A Box Plot is also known as Whisker plot is created to display the summary of the set of data
values having properties like minimum, first quartile, median, third quartile and maximum. In
the box plot, a box is created from the first quartile to the third quartile, a vertical line is also
there which goes through the box at the median. Here x-axis denotes the data to be plotted
while the y-axis shows the frequency distribution.
A violint plot allow to visualize the distribution of a numeric variable for one or several
groups. Seaborn is particularly adapted to build it thanks to its violin() function. Violinplots
deserve more attention compared to boxplots that can sometimes hide features of the data.
Task no. 37: