我有一个数据帧:
speciality_id speciality_name
1 Acupuncturist
2 Andrologist
3 Anaesthesiologist
4 Audiologist
5 Ayurvedic Doctor
6 Biochemist
7 Biophysicist
我想复制上述数据帧的值范围,年和月
例如:
year = [2018]
Month = [1,2]
我想生成如下所示的数据帧:
Year Month speciality_id speciality_name
2018 1 1 Acupuncturist
2018 1 2 Andrologist
2018 1 3 Anaesthesiologist
2018 1 4 Audiologist
2018 1 5 Ayurvedic Doctor
2018 1 6 Biochemist
2018 1 7 Biophysicist
2018 2 1 Acupuncturist
2018 2 2 Andrologist
2018 2 3 Anaesthesiologist
2018 2 4 Audiologist
2018 2 5 Ayurvedic Doctor
2018 2 6 Biochemist
2018 2 7 Biophysicist
我想不出一个办法。正确的方法是什么
您可以通过^{} 计算笛卡尔积,然后使用平铺数据帧连接:
对所有组合使用} :
product
,使用左连接创建DataFrame
和^{我希望你能帮上忙
相关问题 更多 >
编程相关推荐