title: How to remove a string of a certain length?
body: <p>I have pandas.core.series.Series of text. I want to keep only sentences whose lengths are lesser than 512.</p>
  <pre><code>0        Lebanon, officially known as the Republic of Lebanon, is a country in Western Asia. It is bordered by Syria to the north and east and Israel to the south, while Cyprus lies west across the Mediterranean Sea. Lebanon's location at the crossroads of the Mediterranean Basin and the Arabian hinterland has contributed to its rich history and shaped a cultural identity of religious and ethnic diversity At just 10,452 km2 (4,036 mi2), it is the smallest recognized sovereign state on the mainland Asian continent The earliest evidence of civilization in Lebanon dates back more than seven thousand years, predating recorded history.
  1        Lebanon was home to the Phoenicians, a maritime culture that flourished for almost three thousand years (c. 3200–539 BC). In 64 BC, the region came under the rule of the Roman Empire, and eventually became one of its leading centers of Christianity. The Mount Lebanon range saw the emergence of a onastic tradition known as the Maronite Church. As the Arab Muslims conquered the region, the Maronites held onto their religion and identity. However, a new religious group, the Druze, established themselves in Mount Lebanon as well, generating a religious divide that has lasted for centuries. During the Crusades, the Maronites re-established contact with the Roman Catholic Church and asserted their communion with Rome. These ties have influenced the region into the modern era.
  </code></pre>
  <p>then I want to remove if there's len(sentence) &gt; 512. So, the output will be:</p>
  <pre><code>0        Lebanon, officially known as the Republic of Lebanon, is a country in Western Asia. It is bordered by Syria to the north and east and Israel to the south, while Cyprus lies west across the Mediterranean Sea.
  1        Lebanon was home to the Phoenicians, a maritime culture that flourished for almost three thousand years (c. 3200–539 BC). In 64 BC, the region came under the rule of the Roman Empire, and eventually became one of its leading centers of Christianity. The Mount Lebanon range saw the emergence of a monastic tradition known as the Maronite Church. As the Arab Muslims conquered the region, the Maronites held onto their religion and identity.       However, a new religious group, the Druze, established themselves in Mount Lebanon as well, generating a religious divide that has lasted for           centuries. During the Crusades, the Maronites re-established contact with the Roman Catholic Church and asserted their communion with Rome. These ties have influenced the region into the modern era.
  </code></pre>
  <p>Can I use this code? Thanks for helping.</p>
  <pre><code>remove = [x for x in text if len(x) &lt; 512]
  </code></pre>
  <p>I have tried solution from <a href="https://stackoverflow.com/questions/19937362/python-pandas-filter-string-data-based-on-its-string-length">Python: Pandas filter string data based on its string length</a>, but it's different case.</p>