# assignment of three series s1, s2, s3
s1
=
pd.Series ([
0
,
4
,
8
])
s2
=
pd.Series ([
1
,
5
,
9
])
s3
=
pd.Series ([
2
,
6
,
10
])
# get index and column values
dframe
=
pd.DataFrame ([s1, s2, s3])
# assign column name
dframe.columns
=
[
' Geeks'
,
'For'
,
'Geeks'
]
# write b data to CSV file
dframe.to_csv (
'pythonengineering.csv'
, index
=
False
)
dframe.to_csv (
'pythonengineering1.csv'
, index
=
True
)
Output:
pythonengineering1.csvpythonengineering2.csv
2. Handling Missing Data
The Data Analysis Phase also includes the ability to handle missing data from our dataset, and it's no surprise that Pandas also live up to that expectation. This is where dropna
and / or fillna
come into play. When dealing with missing data, you, as a data analyst, have to either drop the column containing NaN values (dropna method) or fill the missing data with the mean or mode of the entire record in the column (fillna method), this is the solution is very important and depends on the data and the impact will create in our results.

Output:
axis = 0axis = 1
fillna
is used, which can replace all NaN values from a specific column, or even the whole DataFrame as per

Output:
3. Group method (aggregation):
The groupby method allows us to group data based on any row or column, so we can additionally apply aggregate functions to analyze our data. Group rows using a cartographer (dict or key function, apply this function to a group, return the result as a row) or by a series of columns.
Note that this is a DataFrame generated by the following code:

Output:
Google BigQuery: The Definitive Guide PDF download. Data Warehousing, Analytics, and Machine Learning at Scale, 1st Edition, 2019. Work with petabytescale datasets while building a collaborative a...
31/08/2021
We live in an age of socalled Big Data. We hear terms like data scientist, and there is much talk about analytics and the mining of large amounts of corporate data for tidbits of business value. Ther...
10/07/2020
Mastering regular expressions by Jeffrey Friedl, 3rd edition. Regular expressions are an extremely powerful tool for manipulating text and data. They are standard features today in a variety of pop...
05/09/2021
Pandas 1.x Cookbook: Practical recipes for scientific computing, time series analysis, and exploratory data analysis using Python, 2nd Edition....
05/09/2021