از سایت بن بست با پایتون امتحان کانکشن گرفتن مقادیر با تاریخ شمسی خروجی اکسل
Tag: pandas
Get value from next row in pandas dataframe
use the Shift() function with groupby!
5 ways to apply an IF condition in pandas DataFrame
from Need to apply an IF condition in Pandas DataFrame? If so, in this tutorial, you’ll see 5 different ways to apply such a condition. Specifically, you’ll see how to apply an IF condition for: Set of numbers Set of numbers and lambda Strings Strings and lambada OR condition Applying an IF condition in Pandas DataFrame… Continue reading 5 ways to apply an IF condition in pandas DataFrame
pandas groupby
تفاوتهای ۵ تابع اصلی در پایتون پانداس در این پست با مثال توضیح داده شدهاند.
Save to Excel
Pandas Transform and Filter
Split Apply Combine Filter Data with Transform Transform with Lambda Filter with Pandas Groupby use Map to create a new Column see more also
فرمت اعداد در پانداس
برای فرمت سه رقم سه رقم جدا شده و نمایش تا دو رقم اعشار در پایتون پانداس از این کد استفاده ببرید. یا این کد برای هر ستون
pandas create new column based on values from other columns
Selecting Subsets of Data in Pandas
from What Code single column df[‘food’] multiple columns df[[‘color’, ‘food’, ‘score’]] single row df.loc[‘Niko’] multiple rows df.loc[[‘Niko’, ‘Penelope’]] slice notation to select a range of rows df.loc[‘Niko’:’Dean’] df.loc[:’Aaron’] stepping by 2 df.loc[‘Niko’:’Christina’:2] rows and columns df.loc[row_selection, column_selection] df.loc[‘Jane’:’Penelope’, [‘state’, ‘color’]] single row df.iloc[3] multiple rows df.iloc[[5, 2, 4]] df.iloc[3:5] df.iloc[[2,3], [0,… Continue reading Selecting Subsets of Data in Pandas
python, Pandas Categorize the range
df[‘PriceBin’] = pd.cut(df[‘PriceAvg’], bins = 3)df[‘PriceBin’].value_counts() (54060.0, 2040000.0] 209 (2040000.0, 4020000.0] 4 (4020000.0, 6000000.0] 1 Name: PriceBin, dtype: int64 df[‘PriceBin’] = pd.qcut(df[‘PriceAvg’], q=3) df[‘PriceBin’].value_counts().sort_index() (59999.999, 210000.0] 77 (210000.0, 315000.0] 66 (315000.0, 6000000.0] 71 Name: PriceBin, dtype: int64 PriceBin SalesAvg0(59999.999, 210000.0] 42.0000001(210000.0, 315000.0] 145.1666672(315000.0, 6000000.0] 114.200000