You should not name your file name as geopandas.py. From the traceback of from geopandas import GeoSeries, GeoDataFrame, we can know that the file name you are using is geopandas.py and it makes Python import this file rather than the geopandas module. Change this file at the following path to other names and it should work.
from geopandas import GeoSeries, GeoDataFrame
File "C:\Users\XXXXX\Documents\Python_Scripts\geopandas.py", line 1, in <module>
---------------
Answer from Tai on Stack Overflowpython - Error : module 'geopandas' has no attribute 'read_file' - Stack Overflow
python - geopandas attribute issue to read in file - Stack Overflow
python - GeoPandas has new warning and cannot read_file() - Geographic Information Systems Stack Exchange
python - Geopandas read_file - Stack Overflow
See my comment in Fiona's issue tracker: https://github.com/Toblerity/Fiona/issues/986
GDAL (the library Fiona uses to access the geodata) maintains an iterator over the features that are currently read. There a some operations that, for some drivers, can influence this iterator. Thus, after such operations we have to ensure that the iterator is set to the correct position that a continuous read of the data is ensured. Such operations include counting all features in a dataset, respectively calculating its extent.
There are different types of drivers in GDAL. Some drivers support random access, while some do not. For the drivers that do not support random access, the resetting of the iterator involves reading all features again up to the iterator position. As this is a possible costly operation, this RuntimeWarning is emitted, so that users are aware of this behavior.
I found this fiona PR that references the warning: https://github.com/Toblerity/Fiona/pull/965
I can reproduce the issue with fiona 1.8.18 when calling list(src) on a recently opened Collection, but not with 1.8.17. So I think this is a regression that was introduced in fiona 1.8.18, released on 2020-11-17.
import geopandas
shp=geopandas.read_file(geopandas.datasets.get_path("nybb"))
ImportError: the 'read_file' function requires the 'fiona' package, but it is not installed or does not import correctly. Importing fiona resulted in: DLL load failed while importing ogrext: The specified module could not be found.
Versions as seen from "conda list":
fiona 1.8.13.post1
gdal 3.0.2
geopandas 0.9.0
If you don't select geometry column from a GeoDataFrame, you get a DataFrame.
For example:
print type(trialyield[['column1', 'column2']])
# OUT:
# pandas.core.frame.DataFrame
print type(trialyield[['column1', 'column2', 'geometry']])
# OUT:
# geopandas.geodataframe.GeoDataFrame
Change the last line in following way:
trialyield[[title_col, 'yield', 'geometry']].to_file('trialyield_output.shp')
Although a previous answer is correct that geopandas.read_file - GeoPandas documentation will return a pandas.core.frame.DataFrame instead of a geopandas.geodataframe.GeoDataFrame if the data doesn't have a geometry column, that doesn't mean GeoDataFrame.to_file() cannot be used to write out the pandas dataframe.
This is one aspect of the geodataframe implementation I have always found odd/annoying. There is additional functionality with geodataframes compared to dataframes, e.g., to_file(), that aren't related to having geometry, but no geometry means no geodataframe.
I use geopandas.geodataframe.GeoDataFrame to write pandas dataframes to DBF files or geodatabase tables, it only requires changing the syntax.
import geopandas
df # a pandas dataframe without geometry column
folder # path to folder
fgdb # path to file geodatabase
# writing df as DBF using geopandas
geopandas.GeoDataFrame.to_file(df, folder, "Esri Shapefile", layer="TableA")
# writing df as FGDB table using geopandas
geopandas.GeoDataFrame.to_file(df, fgdb, "OpenFileGDB", layer="TableA")