フィルターのクリア

Translation of Python to Matlab

3 ビュー (過去 30 日間)
Simon Schmidt
Simon Schmidt 2021 年 5 月 2 日
回答済み: Arthi Sathyamurthi 2021 年 5 月 28 日
Hello,
i need to translate python code into MATLAB and struggle with the "HELP" section.
matrix = []
# Column names
cols = ['date_block_num','shop_id','item_id']
# Creating the pairwise for each date_num_block
for i in range(34):
# Filtering sales by each month
sales = df_train[df_train.date_block_num==i]
# HEEELP: Creating the matrix date_block, shop_id, item_id
matrix.append(np.array(list(product([i], sales.shop_id.unique(), sales.item_id.unique())), dtype='int16'))

回答 (1 件)

Arthi Sathyamurthi
Arthi Sathyamurthi 2021 年 5 月 28 日
Hello Simon,
You can see the MathWorks documentation here to know how to append new rows to a matrix. Incase you want to append new rows to a table you can look at the MathWorks documentation here.
If you have functions and objects in Python, you can call them directly from MATLAB. This allows you to work entirely within MATLAB without switching your programming environment. To know more about calling Python libraries from MATLAB click here. To know how to access Python Libraries in Matlab, click here.

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by