我试图提取顶级网址并忽略路径。我使用下面的代码:熊猫功能花费时间太长
for row in Mexico['Page URL']:
parsed_uri = urlparse('http://www.one.com.mx/furl/Conteúdo Raiz/Meu')
Mexico['SubDomain'] = '{uri.scheme}://{uri.netloc}/'.format(uri=parsed_uri)
此脚本已运行过去一小时。当我运行它,它给了以下警告:
/anaconda/lib/python3.6/site-packages/ipykernel_launcher.py:3: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
This is separate from the ipykernel package so we can avoid doing imports until
我会很感激,如果任何人都可以在一个更快的方法提出建议,也许对方法的“警告”指针显示
一开始移动'urlparse'外循环调用。它每次都做同样的事情。你甚至不会在你的循环中使用'row',那么为什么有循环?你输错了你的代码吗? –
感谢您的协助。数据帧的URL不同。如果我将这一点从循环中移出,我将如何为此进行调整? –
这可能是我isse的一部分。我试图循环遍历数据框并复制域/子域,忽略路径 –