首页 \ 问答 \ 如何在pandas数据框列中的数值之前删除字符串?(How to remove strings before a numeric value in a pandas dataframe column?)

如何在pandas数据框列中的数值之前删除字符串?(How to remove strings before a numeric value in a pandas dataframe column?)

我有一个带有字符串的熊猫数据框列,如下所示:

Column A

text moretext 251 St. Louis Apt.54
123 Orange Drive
sometext somemoretext 171 Poplar street
textnew 11th street 
77 yorkshire avenue

我想删除数字值之前的文本,即我想输出是这样的:

Column A

251 St. Louis Apt.54
123 Orange Drive
171 Poplar street
11th street 
77 yorkshire avenue

I have a pandas dataframe column with strings that looks like this:

Column A

text moretext 251 St. Louis Apt.54
123 Orange Drive
sometext somemoretext 171 Poplar street
textnew 11th street 
77 yorkshire avenue

I want to remove the text before the numeric values i.e I want the output to be something like this:

Column A

251 St. Louis Apt.54
123 Orange Drive
171 Poplar street
11th street 
77 yorkshire avenue

原文:https://stackoverflow.com/questions/49762063
更新时间:2022-03-07 13:03

最满意答案

这就是你如何使用绝对定位将一个div居中对齐另一个div的顶部(或者在另一个div中,你应该发布你的html或做一个小提琴)。这不应该影响你的jquery

假设HTML

<div class="konteineris">
  <div class="konteineris2"></div>
</div>

垂直和水平居中对齐

   .konteineris2{
      position:absolute;
      left: 50%;
      top: 50%;
      margin: -350px 0 0 -430px;
    }

水平居中对齐

   .konteineris2{
      position:absolute;
      left: 50%;
      top: 0%;
      margin: 0 0 0 -430px;
    }

This is how you use absolute positioning to center align a div on top of another div (or inside another div, you should post your html or make a fiddle).This should not effect your jquery

Assumed HTML

<div class="konteineris">
  <div class="konteineris2"></div>
</div>

Vertically and Horizontally center aligned

   .konteineris2{
      position:absolute;
      left: 50%;
      top: 50%;
      margin: -350px 0 0 -430px;
    }

Horizontally center aligned

   .konteineris2{
      position:absolute;
      left: 50%;
      top: 0%;
      margin: 0 0 0 -430px;
    }

相关问答

更多
  • 不使用position: absolute ,你必须垂直对齐。 您可以使用vertical-align: bottom ,根据文档 : vertical-align CSS属性指定内联或表格单元格的垂直对齐方式。 因此,要么将外部div设置为内联元素,要么将其设置为table-cell : #outer { height: 200px; width: 200px; border: 1px solid red; display: table-cell; vertical-alig ...
  • 希望以下代码有所帮助。 我把图像作为背景图像的背景图像background-size: cover; 。 我还将标签分成顶部和底部,并使用左右浮动来定位标签。 .contentContainer { position: relative; width: 300px; height: 300px; border: 1px solid black; margin: 5px; background: url('https://dummyimage.com/100/000000/ ...
  • 我认为其他人误解了你的目标。 随意看我的codepen: http://codepen.io/anon/pen/MeyYWV?editors=1100 我为你做了一些重组规则,为了方便我添加了一个类: .update, .newmembers, .latest{ padding:0 0 1em; position:relative; float:left; margin: 10px 20px; display: inline-block; background-color: #474 ...
  • 使用right:0而不是left:400px 。 这将div放在页面的右侧。 由于width:300px ,因此您需要将text-align:right以便按钮显示在div的右侧。 div.fixed { position: fixed !important; top: 45px !important; right: 0px !important; width: 300px; text-align:right; }
  • 只需在您的徽标和导航上使用更高的z-index,它就可以按您的意愿使用。 Just use an higher z-index on your logo and nav and it will work as you wish.
  • 这就是你如何使用绝对定位将一个div居中对齐另一个div的顶部(或者在另一个div中,你应该发布你的html或做一个小提琴)。这不应该影响你的jquery 假设HTML
    垂直和水平居中对齐 .konteineris2{ position:absolute; left: 50%; top: 50%; margin: -3 ...
  • 如果要将元素放在绝对位置下方,则可以添加一个边距来向下一个元素减去“跳过”绝对项目的空间和存在所需的距离。 在代码中,该项目仍然在您的绝对项目下方,但仍然可视地显示在其下方。 If you are putting an element below the absolute position, you can add a margin to bump down your next element the distance required to "skip" the absolute item's space ...
  • 我不太确定这是不是你想要的。 但是div没有正确排列的原因是因为金条有这个余量:0自动。 这告诉它始终保持在页面的中心位置。 然后你有了你的.itemlist,无论浏览器的宽度如何,都被告知它始终位于页面左侧30%的位置。 如果你试图集中你的项目列表,我会做left: 0; right: 0; margin: 0 auto; left: 0; right: 0; margin: 0 auto; 关于绝对要素。 小提琴: https : //jsfiddle.net/caoz7sn2/2/ I'm not t ...
  • 你会期望relative div d3保持相对于它的父亲的位置。 有关如何定位的更多信息,请参阅W3 Css规范 。 我强调应该因为盒子模型的个别浏览器中存在可能对此产生影响的怪癖。 请参阅JSFiddle Here以获得此快速演示。 You would expect the relative div d3 to maintain position relative to it's parent. See W3 Specification for Css for more information on ho ...
  • 它可以通过给出顶部:100%; 对于图标包装器,它将始终位于header_main的底部,检查下面的工作演示; #header_ main{ height:100%; width:100%; position: absolute; background:#ddd; } .icon-wrapper { position:absolute; height: 254px; bottom: 0; background:red; top ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)