Pandas is a library in Python that is used for data manipulation and analysis. It contains data structures that can perform various operations on data files like csv, excel, sql etc. At the backend for every source it creates a data frame which is a tabular structure of a data source. Here I am showing a few basic operations that can be performed using Panads. Here I am taking the example of a csv file.
The first and most basic step is to store all the data in data frame.
- df = pd.read_csv("<Path of CSV File>", sep=",")
- startTime = df.head(1)[<Name of the Date Time Column 1>']
- startTime = pd.to_datetime(startTime,format= '%M:%S.%f')
- endTime = df. head (1)[ )[<Name of the Date Time Column 2>']
- endTime = pd.to_datetime(endTime,format= '%M:%S.%f')
- diff = endTime - startTime
- for i, j in df.iterrows():
- {
- <All the implementation logic here>
- }
- df.equals(df2)
- df_column = pd.concat([df,df2], axis=1, ignore_index=True)
- df_row = pd.concat([df, df1], ignore_index=True)
Hope these basic operations help you to learn and explore Pandas in Python.
Join the conversation! Your thoughts help the community grow.