Always I am indebted.
Regarding the title, I am currently studying pivot_table for pandas and am unable to solve the following problems.Corresponding dataframe
Arrival date Product code Product name Quantity
0 November 16 11111 Pencil 100
1 November 16 11112 Colored pencils 50
2 November 17 11112 Colored pencils 130
3 November 18 11111 Pencil 200
4 November 18 11112 Colored pencils 30
5 November 18 11113 Magic 500
6 November 18 11114 Brush 10
7 November 19th 11113 Magic 150
8 November 19th 11114 Brush 30
9 November 20 11111 Pencil 50
In response to the above, I am trying to execute the following code, pivot_table.
import pandas as pd
data_csv = "./data.csv"
data_pvt = pd.read_csv (data_csv, encoding = "utf_8_sig")
data_pvt.pivot_table (index = "arrival date", values = "quantity", aggfunc = "sum")
The purpose is to calculate the total quantity for each arrival date.
However, when I run the code, I don't see any change in the original dataframe.
There may be rudimentary mistakes.
Sorry for your inconvenience, but could you please tell me where there is a mistake?
Answer # 1
pivot_tableReturns a newly generated DataFrame. The original DataFrame remains unchanged.
data_csv = "./data.csv" df = pd.read_csv (data_csv, encoding = "utf_8_sig") df_pvt = df.pivot_table (index = "arrival date", values = "quantity", aggfunc = "sum") print (df_pvt)
- python - count by element with pivot_table in pandas
- python - i can't understand the specifications of pandas
- python 3x - the reading of the expression in the excel file in pandas becomes nan
- python - i want to modify the value of a specific column or row of pandas using the apply function and the lambda function
- python - pandas attributeerror: module'pandas' has no attribute'read_tabel' error
- python - shuffle a few lines of pandas for weekdays and holidays
- eliminating pandas install and import in python pyenv export ldflags
- python - merge after pandas pivot
- python - [pandas] how to search for unexpected data
- python - about data analysis in pandas
- python - how to load multiple time formats with pandas
- python - about pandas, gspread
- how do i merge dataframes inside a python pandas function?
- python - aggregation processing using pandas
- python - the date format when reading csv data with pandas and graphing it does not work
- python 3x - i want to concatenate data using pandas merge, but it doesn't work
- python 3x - there is an error, but it is not reflected in the log file
- [python] when writing a pandas csv file, a comma "," is inserted at the beginning for some reason
- python - condition extraction of pandas does not work
- python : Pandas: Merge Several DataFrame using several (2) common columns
- python : I can not add data frames to the list
- How to find a coincidence from Excel between 2 columns in Python
- python : Saving changes to the CSV file
- python : How to combine 4 DataFrame in one?
- python : Search the amount in a sliding window from a local maximum in another column to the end of the window
- python : How to create a second one on a column that will reflect the content of the first?
- python : How to identify the frequency of words in the filtered DataFrame and perform their sorting in frequency?
- python : Combining multiple Excel files to one
- python : Delete strings by condition in DataFrame using the Drop method