小编Noc*_*cas的帖子

OSError: [Errno 24] 打开的文件太多 - OS Mojave

所以,我正在编写一个脚本来获取某个数据集,使用不同的随机种子对其进行 100 次采样,完成所有这些数据集,然后获得平均误差。但是,每当我尝试运行脚本时,我都会遇到错误 OSError: [Errno 24] Too many open files

我不明白我能做些什么来解决这个问题(如果我应该在脚本或系统中做一些事情以及什么)。我在 macOS Mojave 中使用 Python 3。有人有线索吗?

python python-3.x macos-mojave

6
推荐指数
1
解决办法
6845
查看次数

Create a column with unique values for every unique value in another column

I have a data frame with a column like

         Customer  
   0.      ABC     
   1.      ABC     
   2.      DEF     
   3.      GHI     
   4.      JKL     
   5.      JKL    
Run Code Online (Sandbox Code Playgroud)

I need to add another column so that I have an id per customer like this:

         Customer  Id
   0.      ABC     1
   1.      ABC     1
   2.      DEF     2
   3.      GHI     3
   4.      JKL     4
   5.      JKL     4
Run Code Online (Sandbox Code Playgroud)

How can I do this?

python dataframe pandas

1
推荐指数
1
解决办法
60
查看次数

标签 统计

python ×2

dataframe ×1

macos-mojave ×1

pandas ×1

python-3.x ×1