Questions tagged «dataframe»

1
熊猫中isna()和isull()之间的区别
我已经使用熊猫已有一段时间了。但是,我不了解熊猫isna()和isnull()熊猫之间有什么区别。而且,更重要的是,可使用哪一个来识别数据框中的缺失值。 如何将值检测为na或的基本根本区别是null什么?


2
如何对熊猫中按两列分组的值求和
我有一个这样的Pandas DataFrame: df = pd.DataFrame({ 'Date': ['2017-1-1', '2017-1-1', '2017-1-2', '2017-1-2', '2017-1-3'], 'Groups': ['one', 'one', 'one', 'two', 'two'], 'data': range(1, 6)}) Date Groups data 0 2017-1-1 one 1 1 2017-1-1 one 2 2 2017-1-2 one 3 3 2017-1-2 two 4 4 2017-1-3 two 5 我如何生成这样的新DataFrame: Date one two 0 2017-1-1 3 …

3
是否有适用于python的好的即用型语言模型?
我正在为一个应用程序制作原型,我需要一个语言模型来计算一些生成的句子的困惑度。 我可以随时使用经过训练的python语言模型吗?简单的东西 model = LanguageModel('en') p1 = model.perplexity('This is a well constructed sentence') p2 = model.perplexity('Bunny lamp robert junior pancake') assert p1 < p2 我看过一些框架,但找不到我想要的。我知道我可以使用类似: from nltk.model.ngram import NgramModel lm = NgramModel(3, brown.words(categories='news')) 这在Brown Corpus上使用了很好的图林概率分布,但是我正在一些大型数据集(例如1b单词数据集)上寻找精心设计的模型。我可以真正相信一般领域的结果(不仅是新闻)
11 python  nlp  language-model  r  statistics  linear-regression  machine-learning  classification  random-forest  xgboost  python  sampling  data-mining  orange  predictive-modeling  recommender-system  statistics  dimensionality-reduction  pca  machine-learning  python  deep-learning  keras  reinforcement-learning  neural-network  image-classification  r  dplyr  deep-learning  keras  tensorflow  lstm  dropout  machine-learning  sampling  categorical-data  data-imputation  machine-learning  deep-learning  machine-learning-model  dropout  deep-network  pandas  data-cleaning  data-science-model  aggregation  python  neural-network  reinforcement-learning  policy-gradients  r  dataframe  dataset  statistics  prediction  forecasting  r  k-means  python  scikit-learn  labels  python  orange  cloud-computing  machine-learning  neural-network  deep-learning  rnn  recurrent-neural-net  logistic-regression  missing-data  deep-learning  autoencoder  apache-hadoop  time-series  data  preprocessing  classification  predictive-modeling  time-series  machine-learning  python  feature-selection  autoencoder  deep-learning  keras  tensorflow  lstm  word-embeddings  predictive-modeling  prediction  machine-learning-model  machine-learning  classification  binary  theory  machine-learning  neural-network  time-series  lstm  rnn  neural-network  deep-learning  keras  tensorflow  convnet  computer-vision 

3
在DataFrame中找到连续的零并进行条件替换
我有一个像这样的数据集: 样本数据框 import pandas as pd df = pd.DataFrame({ 'names': ['A','B','C','D','E','F','G','H','I','J','K','L'], 'col1': [0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0], 'col2': [0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0]}) 我想,以取代一些0的中col1和col2用1的,而不是替代0的,如果三个或更多0的是在同一列的连续。熊猫怎么办? 原始数据集: names col1 col2 A 0 0 B 1 0 C 0 …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.